Switch quantity not an integer

This is a discussion on Switch quantity not an integer within the C Programming forums, part of the General Programming Boards category; What should I do to fix this error: "Switch quantity not an integer" with this piece of code? Code: if(argc ...

  1. #1
    Registered User
    Join Date
    Apr 2012
    Posts
    1

    Switch quantity not an integer

    What should I do to fix this error: "Switch quantity not an integer" with this piece of code?
    Code:
    if(argc == 2){
            switch(argv[letter]){
                case 'g':
                    for(j = 0; j < (width * height); j++){
                            scanf("%c%c%c", &image[j].r, &image[j].g, &image[j].b);
                    }
                    i = greyscale(image);
                    break;
                case 'r':
                    for(j = 0; j < (width * height) - 1; j++){
                            scanf("%c%c%c", &image[j].r, &image[j].g, &image[j].b);
                    }
                    i = rotation(image);
                    break;
                default:
                    printf("%c%c%c", image[j].r, image[j].g, image[j].b);
                }
            }
    It's for a programming assignment and I'm supposed to execute the program like this: ./a.out r < ****.ppm(for rotation) or ./a.out g < ****.ppm (for greyscale).

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,176
    O_o

    If you have a `char **' and dereference it you get a `char *'.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Concept of Quantity
    By Yarin in forum General Discussions
    Replies: 261
    Last Post: 04-01-2011, 11:09 AM
  2. Counting quantity of different digits
    By cowa in forum C Programming
    Replies: 1
    Last Post: 11-17-2009, 11:09 AM
  3. left shifting signed quantity
    By BEN10 in forum C Programming
    Replies: 6
    Last Post: 04-01-2009, 07:39 AM
  4. switch quantity not integer?
    By Front/slash in forum C Programming
    Replies: 5
    Last Post: 06-01-2007, 07:15 AM
  5. "Magos is an unknown quantity at this point"
    By Magos in forum A Brief History of Cprogramming.com
    Replies: 36
    Last Post: 04-30-2004, 11:27 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21