在一个字符串中连接偶数和奇数位置

时间:2017-03-14 16:07:01

标签: c string concatenation

我正在学习编码的基础知识。任何人都可以说我的代码出了什么问题 问题:给定一个长度为N且从0到N-1索引的字符串S,将其偶数索引和奇数索引字符打印为一行上2个以空格分隔的字符串

NOTE: CALL EXECUTE routine executed successfully, but no SAS statements were generated.
MPRINT(ETLS_GETPARAMETERS):  ;
MPRINT(ETLS_PROCESSTOLOOPWPM8XG):  ;
Process ID: 31002
MPRINT(ETLS_JOBWPM8XQ):   options metaport = 8560 metaserver = "xxxl01010.xxxxxx.com.au";
MPRINT(ETLS_SETDEBUG):   OPTIONS MPRINT;
MPRINT(ETLS_JOBWPM8XQ):  ;
MPRINT(ETLS_JOBWPM8XQ):   LIBNAME TDST1V TERADATA SERVER="xxxx8.xxxxxxx.xxx.xx" SCHEMA=IUSIT02_STG_ED_VIEW AUTHDOMAIN="Teradata 
Auth" ;
NOTE: Libref TDST1V was successfully assigned as follows: 
      Engine:        TERADATA 
      Physical Name: xxxx8.xxxxxxxx.com.XX
MPRINT(ETLS_JOBWPM8XQ):  ;
MPRINT(ETLS_JOBWPM8XQ):   options comamid=TCP;
MPRINT(ETLS_JOBWPM8XQ):   data _null_;
MPRINT(ETLS_JOBWPM8XQ):   signon AuthDomain="DefaultAuth" noscript;

ERROR: Retrieving login information based on AuthenticationDomain from the SAS Metadata Server failed.
ERROR: Remote signon canceled.
MPRINT(ETLS_JOBWPM8XQ):   run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      user cpu time       0.00 seconds
      system cpu time     0.00 seconds
      memory              352.59k
      OS Memory           13464.00k
      Timestamp           15/03/2017 02:39:09 AM
      Step Count                        84  Switch Count  55
      Page Faults                       0
      Page Reclaims                     9
      Page Swaps                        0
      Voluntary Context Switches        209
      Involuntary Context Switches      0
      Block Input Operations            0
      Block Output Operations           0

140                                                        The SAS System                            02:01 Wednesday, March 15, 2017


MPRINT(ETLS_JOBWPM8XQ):   data _null_;
MPRINT(ETLS_JOBWPM8XQ):   if 9.4 ge 9 then rmtname = "/ remote = local";
MPRINT(ETLS_JOBWPM8XQ):   else rmtname = "";
MPRINT(ETLS_JOBWPM8XQ):   call execute('%syslput job_rc = &job_rc '||rmtname||';');
MPRINT(ETLS_JOBWPM8XQ):   call execute('%syslput trans_rc = &trans_rc '||rmtname||';');
MPRINT(ETLS_JOBWPM8XQ):   call execute('%syslput sqlrc = &sqlrc '||rmtname||';');
MPRINT(ETLS_JOBWPM8XQ):   call execute('%syslput syscc = &syscc '||rmtname||';');
MPRINT(ETLS_JOBWPM8XQ):   call execute('%syslput etls_stepStartTime  = &etls_stepStartTime'||rmtname||';');
MPRINT(ETLS_JOBWPM8XQ):   call execute('run;');
MPRINT(ETLS_JOBWPM8XQ):   run;

ERROR: A link must be established by executing the SIGNON command before you can communicate with LOCAL.
ERROR: A link must be established by executing the SIGNON command before you can communicate with LOCAL.
ERROR: A link must be established by executing the SIGNON command before you can communicate with LOCAL.
ERROR: A link must be established by executing the SIGNON command before you can communicate with LOCAL.
ERROR: A link must be established by executing the SIGNON command before you can communicate with LOCAL.

1 个答案:

答案 0 :(得分:0)

你必须将'\ 0'放在字符串末尾的最后一个字符串中。

odd[p]='\0';
even[k]='\0';

在连接之前使用这2行。