Thread: Switch quantity not an integer

  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
    5,108
    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, 12:09 PM
  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