main()
{
char *ptr = "Ramco Systems";
(*ptr)++;
printf("%s\n",ptr);
ptr++;
printf("%s\n",ptr);
}
Find the Outputs?
Answer Posted / dhakchin moorthy.p
first printf stmt prints Ramco Systems
the error is in line ptr++;here u r trying to increment the
address holding by the pointer,pointer var may lost the
starting address.
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }
What is auto keyword in c?
What is the easiest sorting method to use?
Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?
application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above
What does %d do?
How can a process change an environment variable in its caller?
Explain what is the purpose of "extern" keyword in a function declaration?
What is function in c with example?
How are portions of a program disabled in demo versions?
Can we change the value of static variable in c?
What is the difference between a string and an array?
Explain a file operation in C with an example.
Explain what will be the outcome of the following conditional statement if the value of variable s is 10?
What are the different types of control structures?