Coding for the PSP, but mainly C Programming help!

This is a discussion on Coding for the PSP, but mainly C Programming help! within the C Programming forums, part of the General Programming Boards category; Hi guys, I'm new to C and new here hopeing I can be here more often. I came for help. ...

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    4

    Coding for the PSP, but mainly C Programming help!

    Hi guys, I'm new to C and new here hopeing I can be here more often. I came for help. I was wondering how to use variables but for text.

    I tried doing this:
    Code:
       char c = "You have just pressed";
    *snip*
       if(pad.Buttons & PSP_CTRL_CROSS) {
            pspDebugScreenPrintf("&c cross.\n");
            }
    
    and from my Cygwin output I get,
    main.c: In function 'main':
    main.c:50: warning: initialization makes integer from pointer without a cast
    main.c:52: warning: unused variable 'i'
    main.c:51: warning: unused variable 'counter'
    main.c:50: warning: unused variable 'c'
    main.c:75:2: warning: no newline at end of file
    Help please! Thanks in advance!

    NOTE: I'm coding for a PSP but I hope thats fine with you guys, I just want to know how to use text in a variable so I don't have to keep typing the same thing over and over again.

  2. #2
    Registered User
    Join Date
    Mar 2005
    Posts
    135
    const char *c = "You have just pressed";

    or..

    char c[] = "You have just pressed";

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    4
    And how would I use it in my pspDebugScreenPrintf("&c cross.\n"); line? Do I use &c or %c?

  4. #4
    Registered User
    Join Date
    Feb 2005
    Posts
    38
    Depends on the parameters you pass to that function. But if pspDebugScreenPrintf() is similar to printf, it will be:

    Code:
    pspDebugScreenPrintf("%s cross.\n", c);
    I like to play pocket pool.

  5. #5
    Registered User
    Join Date
    Nov 2005
    Posts
    4
    Quote Originally Posted by NoUse
    Depends on the parameters you pass to that function. But if pspDebugScreenPrintf() is similar to printf, it will be:

    Code:
    pspDebugScreenPrintf("%s cross.\n", c);
    Thanks guys, I got all the help I needed! Thank you!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 03-20-2009, 05:22 PM
  2. Coding Guideline ....!!
    By imfeelingfortun in forum Tech Board
    Replies: 8
    Last Post: 10-08-2006, 07:09 AM
  3. Before Coding
    By cyberCLoWn in forum C++ Programming
    Replies: 16
    Last Post: 12-15-2003, 01:26 AM
  4. Coding Contest....
    By Koshare in forum A Brief History of Cprogramming.com
    Replies: 46
    Last Post: 10-14-2001, 04:32 PM

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