How to display the first letter of array of pointers to strings with pointers to pointers in C

1 Answer

0 votes
#include <stdio.h>

int main(int argc, char **argv) 
{ 
    char *scientists[] = {
                            "Albert Einstein",
                            "Isaac Newton",
                            "Marie Curie",
                            "Galileo Galilei",
                            "Charles Darwin"
                         };
                        
    for(int i = 0; i < 5; i++)
    {
        putchar(**(scientists + i));
        putchar('\n');
    }
      
        
    return 0;
}

/*
run:

A
I
M
G
C

*/

 



answered Jun 30, 2015 by avibootz
...