Advertisements

Search results for register

Example:[1]

            What is the output of the following c program?
#include <stdio.h>
void main()
{
    register int i = 10;
    int *p = &i;
    *p = 11;
    printf("%d %d\n", i, *p);
}

          
Option A:

            11,11
            
Option B:

            10,11
            
Option C:

            10,10
            
Option D:

            Compile error
            
Correct Answer: option D
Example:[2]

            What is the output of the following c program?
#include <stdio.h> 
void main() 
{ 
    int i = 10; 
    register int *a = &i; 
    *a = 11;
    printf("%d,%d",i, *a);  
} 
          
Option A:

            10,10
            
Option B:

            11,11
            
Option C:

            11,10
            
Option D:

            10,11
            
Correct Answer: option B
Example:[3]

            What is the output of the following c program?
#include <stdio.h>
register int var2 = 10;
void main()
{
    int var1 = 10;
    var1++;
    var2++;
    printf("%d,%d\n", var1,var2);
}
          
Option A:

            10,10
            
Option B:

            11,11
            
Option C:

            11,10
            
Option D:

            Compile error
            
Correct Answer: option D

 Search Links


 Popular C search MCQs


 Popular C search examples