C statement to copy a string without using loop and library
function..
Answers were Sorted based on User's Feedback
Answer / abhishek soni
main(){
char ch[10]="Welcome";
char copy[10];
int i=0;
clrscr();
copyStr:
copy[i] = ch[i++];
if(ch[i] != '\0')
goto copyStr;
printf("%s",copy);
getch();
}
| Is This Answer Correct ? | 72 Yes | 8 No |
Answer / goresh
main()
{
char str1[]="My name is Goresh...";
char *p;
p=str1;
printf("%s",p);
}
| Is This Answer Correct ? | 28 Yes | 13 No |
void main() { printf(“sizeof (void *) = %d \n“, sizeof( void *)); printf(“sizeof (int *) = %d \n”, sizeof(int *)); printf(“sizeof (double *) = %d \n”, sizeof(double *)); printf(“sizeof(struct unknown *) = %d \n”, sizeof(struct unknown *)); }
Program to find the largest sum of contiguous integers in the array. O(n)
what is the code of the output of print the 10 fibonacci number series
main() { float i=1.5; switch(i) { case 1: printf("1"); case 2: printf("2"); default : printf("0"); } }
To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']
struct Foo { char *pName; char *pAddress; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); obj->pName = malloc(100); obj->pAddress = malloc(100); strcpy(obj->pName,"Your Name"); strcpy(obj->pAddress, "Your Address"); free(obj); printf("%s", obj->pName); printf("%s", obj->pAddress); } a. Your Name, Your Address b. Your Address, Your Address c. Your Name Your Name d. None of the above
Is this code legal? int *ptr; ptr = (int *) 0x400;
main() { int i, n; char *x = “girl”; n = strlen(x); *x = x[n]; for(i=0; i<n; ++i) { printf(“%s\n”,x); x++; } }
main() { int i =0;j=0; if(i && j++) printf("%d..%d",i++,j); printf("%d..%d,i,j); }
Write a program that find and print how many odd numbers in a binary tree
What is wrong with the following code? int *foo() { int *s = malloc(sizeof(int)100); assert(s != NULL); return s; }
how to test pierrot divisor