Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
String Pointers
What will be printed as the result of the operation below:
main() {
char *ptr = " Cisco Systems";
*ptr++; printf("%s\n",ptr);
ptr++;
printf("%s\n",ptr);
}
✍: FYIcenter
1) ptr++ increments the ptr address to point to the
next address.
In the prev example, ptr was pointing to the space in
the string before C, now it will point to C.
2)*ptr++ gets the value at ptr++, the ptr is
indirectly forwarded by one in this case.
3)(*ptr)++ actually increments the value in the ptr
location. If *ptr contains a space, then (*ptr)++ will
now contain an exclamation mark.
Answer: Cisco Systems
2007-02-26, 11666👍, 0💬
Popular Posts:
What will be printed as the result of the operation below: main() { int a=0; if (a==0) printf("Cisco...
What will be printed as the result of the operation below: #define swap(a,b) a=a+b;b=a-b;a=a-b; void...
Can an anonymous class be declared as implementing an interface and extending a class? An anonymous ...
How To Change System Global Area (SGA)? - Oracle DBA FAQ - Introduction to Oracle Database 10g Expre...
How To Run a JUnit Test Class? A JUnit test class usually contains a number of test methods. You can...