自定义数据结构的设计与应用
1. multiArrayWithErrCode 项目分析
当运行 multiArrayWithErrCode 项目时,它与之前版本的 multiArray 类似,但移除了每行输出后的额外回车符。以下是其源代码分析:
#include <stdio.h>
#include <string.h>
#define kMaxDVDs 4
#define kMaxTitleLength 256
#define kError_printf -1
#define kError_fgets -2
#define kError_none 0
int PrintDVDTitle( int dvdNum, char title[][ kMaxTitleLength ] );
void ReplaceReturnAtEndOfString( char *theString );
int main (int argc, const char * argv[]) {
char title[ kMaxDVDs ][ kMaxTitleLength ];
short dvdNum;
char *result;
int error;
error = printf( "The title array takes up %ld bytes of memory.\n\n",
sizeof( title ) );
if ( erro
超级会员免费看
订阅专栏 解锁全文
177万+

被折叠的 条评论
为什么被折叠?



