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



main() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a...

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

main() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a...

Answer / guest

c) I am OK is not in " "

Is This Answer Correct ?    5 Yes 2 No

main() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a...

Answer / madhu

Runtime error

Is This Answer Correct ?    2 Yes 1 No

main() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a...

Answer / prashant

if quotes are inserted ans will be -->
d) I am O

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More C Code Interview Questions

main() { int i=10; i=!i>14; Printf ("i=%d",i); }

1 Answers  


Is the following code legal? typedef struct a { int x; aType *b; }aType

1 Answers  


1. const char *a; 2. char* const a; 3. char const *a; -Differentiate the above declarations.

3 Answers  


write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30

0 Answers  


main() { char c=' ',x,convert(z); getc(c); if((c>='a') && (c<='z')) x=convert(c); printf("%c",x); } convert(z) { return z-32; }

1 Answers  






How to reverse a String without using C functions ?

33 Answers   Matrix, TCS, Wipro,


Write a program to model an exploding firecracker in the xy plane using a particle system

0 Answers   HCL,


write the function. if all the character in string B appear in string A, return true, otherwise return false.

11 Answers   Google,


what is the output of following program ? void main() { int i=5; printf("%d %d %d %d %d ",i++,i--,++i,--i,i); }

10 Answers  


program to Reverse a linked list

12 Answers   Aricent, Microsoft, Ness Technologies,


Printf can be implemented by using __________ list.

3 Answers  


int main() { int x=10; printf("x=%d, count of earlier print=%d", x,printf("x=%d, y=%d",x,--x)); getch(); } ================================================== returns error>> ld returned 1 exit status =================================================== Does it have something to do with printf() inside another printf().

2 Answers  


Categories