Submission #14899

#TimeUsernameProblemLanguageResultExecution timeMemory
14899cepiloth줄 세우기 (KOI13_jul)C++98
Compilation error
0 ms0 KiB
#include <stdio.h> #include <stdlib.h> #include <string.h> #define TRUE 1 #define FALSE 0 typedef char BOOL; BOOL getUserMessage(char* arg) { char szTemp[256]; printf("input first change \r\n"); scanf("%c", szTemp); arg = (char*)malloc(sizeof(char) * strlen(szTemp)); strcpy(arg, szTemp, strlen(szTemp)); return TRUE; } int main() { BOOL nRet = TRUE; nRet = getUserMessage(); if(nRet == FALSE) printf("invalid message exit() \r\n"); return TRUE; }

Compilation message (stderr)

jul.cpp: In function ‘BOOL getUserMessage(char*)’:
jul.cpp:17:38: error: too many arguments to function ‘char* strcpy(char*, const char*)’
    strcpy(arg, szTemp, strlen(szTemp));
                                      ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from jul.cpp:1:
/usr/include/x86_64-linux-gnu/bits/string3.h:102:1: note: declared here
 __NTH (strcpy (char *__restrict __dest, const char *__restrict __src))
 ^
jul.cpp: In function ‘int main()’:
jul.cpp:25:25: error: too few arguments to function ‘BOOL getUserMessage(char*)’
   nRet = getUserMessage();
                         ^
jul.cpp:10:6: note: declared here
 BOOL getUserMessage(char* arg)
      ^
jul.cpp: In function ‘BOOL getUserMessage(char*)’:
jul.cpp:14:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%c", szTemp);
                       ^