-
}
void func2(int a[][10])
{
printf("Will this work?");
}
main()
{
int a[10][10];
func1(a);
func2(a);
}
">Void func1(int (*a)[10]){ printf("Ok it works");}void func2(int a[][10]){ printf("Will this work?");} main() { int a[10][10]; func1(a); func2(a);}
A) Ok it worksWill this work?B) Will this work?C) Ok it worksD) None of the above
-
-
-
-
-
-
-
-
Point out the error in the following program main() { int a=10; void f(); a=f(); printf("n%d",a); } void f() { printf("nHi"); }
The program is trying to collect the value of a "void" function into an integer variable.
-
What would be the output of the following program? main() { int y=128; const int x=y; printf("%d",x); }
A) 128B) Garbage valueC) ErrorD) 0
-
-
-
Is it acceptable to declare/define a variable in a C header?
A global variable that must be accessed from more than one file can and should be declared in a header file. In addition, such a variable must be defined in one source file. Variables should not be defined in header files, because the header file can be included in multiple source files, which would cause multiple definitions of the variable. The ANSI C standard will allow multiple external definitions,...
-
-
-
case 1: printf("one");
break;
case 2:printf("two");
break;
case 3: printf("three");
break;
}
}
">Ix) main(){ int i=3; switch(i) { default:printf("zero"); case 1: printf("one"); break; case 2:printf("two"); break; case 3: printf("three"); break; } }
threeExplanation :The default case can be placed anywhere inside the loop. It is executed only when all other cases doesn't match.
-
-
Different ways of expressing the same idea.
main(){ char s[ ]="man"; int i; for(i=0;s[ i ];i++) printf("n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);}
Ans:mmmm
aaaa
nnnn
Explanation:s[i], *(i+s), *(s+i), i[s] are all different ways of expressing the same idea. Generally array name is the base address for that array. Here s is the base address. i is the index number/displacement from the base address. So, indirecting... -
Recursion C program.
main() { static int var = 5; printf("%d ",var--); if(var) main(); }
Ans:5 4 3 2 1 Explanation:When static storage class is given, it is initialized once. The change in the value of a static variable is retained even between the function calls. Main is also treated like any other ordinary function, which can be called recursively. -
Loops in C programming.
main()
{
int c[ ]={2.8,3.4,4,6.7,5};
int j,*p=c,*q=c;
for(j=0;j
C Interview Questions
Ans