View Single Post
Join Date: Aug 2006
Posts: 319
Reputation: Luckychap is on a distinguished road 
Solved Threads: 42
Luckychap's Avatar
Luckychap Luckychap is offline Offline
Posting Whiz

Re: Arrays and Pointers

 
0
  #4
Dec 1st, 2008
if u want to print the address of first character in the string it is same as you did with other array. For Ex.

  1. int intArray[3] = {1,2,4};
  2. char *str = "C for Cat";
  3.  
  4. //This will print the address of 1 in inArray array
  5. printf("The address of intArray[1] is %d", intArray);
  6.  
  7. //And this will print the address of 'C' in str
  8. printf("The address of 'C' is %d", str);

the job of puts(str) function is to print all the character starting at address str till it finds '\0'.
When you think you have done a lot, then be ready for YOUR downfall.
Reply With Quote