main()
{
char * strA;
char * strB = I am OK;
memcpy( strA, strB, 6);
}
a. Runtime error.
b. I am OK
c. Compile error
d. I am O
Answers were Sorted based on User's Feedback
Answer / chandra
Answer is (c)compile error
compiler cannot initialize the string with out "". Hence any
compiler throws an error
If the string is with in "", then answer will be(a) Runtime
error.
since the string strA is used with out being initialized
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / prashant
if quotes are inserted ans will be -->
d) I am O
| Is This Answer Correct ? | 0 Yes | 3 No |
struct aaa{ struct aaa *prev; int i; struct aaa *next; }; main() { struct aaa abc,def,ghi,jkl; int x=100; abc.i=0;abc.prev=&jkl; abc.next=&def; def.i=1;def.prev=&abc;def.next=&ghi; ghi.i=2;ghi.prev=&def; ghi.next=&jkl; jkl.i=3;jkl.prev=&ghi;jkl.next=&abc; x=abc.next->next->prev->next->i; printf("%d",x); }
#include<stdio.h> main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s=malloc(sizeof(struct xx)); printf("%d",s->x); printf("%s",s->name); }
main() { extern out; printf("%d", out); } int out=100;
How to access command-line arguments?
#define clrscr() 100 main() { clrscr(); printf("%d\n",clrscr()); }
Is the following code legal? void main() { typedef struct a aType; aType someVariable; struct a { int x; aType *b; }; }
There is a lucky draw held every day. if there is a winning number eg 1876,then all possible numbers like 1867,1687,1768 etc are the numbers that match irrespective of the position of the digit. Thus all these numbers qualify fr the lucky draw prize Assume there is no zero digit in any numbers. write a program to show all the possible winning numbers if a "winning number"is passed as an arguments to the function.
main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }
int i=10; main() { extern int i; { int i=20; { const volatile unsigned i=30; printf("%d",i); } printf("%d",i); } printf("%d",i); }
main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }
9 Answers CSC, GoDB Tech, IBM,
write a program for area of circumference of shapes
How we print the table of 3 using for loop in c programing?