Skip to content

Instantly share code, notes, and snippets.

@mashcom mashcom/pointer.c
Created Jun 16, 2014

What would you like to do?
#include <stdio.h>
int main(int argc, char * argv[]){
int ages[]={12,56,23,34,51};
char *name[]={"blessing","tawanda","prosper","simba","titi"};
int count=sizeof(ages)/sizeof(int);
int i=0;
//retrieve names using for loop
printf(" %s is %d years old \n",name[i],ages[i]);
printf("-------------------going to the pointer-------------------------------\n");
//retrieve using pointers
int *cur_ages=ages;
char **cur_name = name;
printf("%s is %d years old \n",*(cur_name+i),*(cur_ages+i));
printf("----------------------------starting 2nd pointer----------------------------\n");
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.