[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scanf does not properly pass characters

From: igorland
Subject: scanf does not properly pass characters
Date: Sat, 25 Jan 2014 06:46:17 -0800 (PST)

Hello, World!

I have some experience with Java and C++. I have now decided to try out
Objective C. And from the very beginning, I have the following issue.


    // First program

    #import <Foundation/Foundation.h>

    int main (int argc, const char* argv[])
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
        char nameC[50];
        NSLog(@"ENter your name: ");
        scanf("%c", &nameC);
        NSLog(@"Name is: %c", nameC);
        [pool drain];
        return 0;

And this is what I get:


Tried unichar, same thing. Does anyone know what is going on?

P.S. Use Windows 8.1, code with Notepad++.

Thank you!

View this message in context: 
Sent from the GNUstep - General mailing list archive at Nabble.com.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]