Thread: Ouput .bpm excess elements in scalar initializer

  1. #1
    Registered User
    Join Date
    Dec 2014
    Location
    Malibu, California, United States
    Posts
    1

    Unhappy Ouput .bpm excess elements in scalar initializer

    Im trying to output an array to a bmp file but i keep getting and error that says excess elements in scalar initializer.


    i have tried both of these codes and still get the same error.


    float pond[n][n];
    int outputBMP("finaldata.bmp", (float*)pond, 499, 499);

    float pond[n][n];
    val=&pond[n][n];
    int outputBMP("finaldata.bmp", (float*)val, 499, 499);

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > int outputBMP("finaldata.bmp", (float*)pond, 499, 499);
    This isn't a function call.
    It isn't even a prototype.

    int value(42);
    is the same as
    int value = 42;

    Now, can you see that
    int value(a,b,c,d)
    is trying to initialise value, but there are an excess of initialisers (that's the error message).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. warning: excess elements in struct initializer
    By sergioms in forum C Programming
    Replies: 5
    Last Post: 12-06-2011, 11:25 AM
  2. Warning: excess elements in scalar initializer
    By TeRMaL in forum C Programming
    Replies: 9
    Last Post: 10-08-2010, 03:54 AM
  3. warning: excess elements in array initializer
    By redruby147 in forum C Programming
    Replies: 6
    Last Post: 09-30-2009, 06:08 AM
  4. error: braces around scalar initializer...
    By Osiris990 in forum C++ Programming
    Replies: 2
    Last Post: 02-27-2008, 03:22 PM
  5. allocation on heap, scalar/non scalar types
    By curlious in forum C++ Programming
    Replies: 10
    Last Post: 12-30-2003, 05:16 AM

Tags for this Thread