C_String Arrays - Initialization: Notes Code
#include "iostream.h" int main() { char szSymbols[10][6] = { "INTL", "MSFT", "ORCL", "CSCO", "SANYY" }; /*************************************************************************** * * * char szSymbols[][6] = { "INTL", "MSFT", "ORCL", "CSCO", "SANYY" }; * * * ***************************************************************************/ char * pszSymbols[] = { "INTL", "MSFT", "ORCL", "CSCO", "SANYY" }; //OK for ( int i= 0; i < 5; i++ ) { cout << szSymbols[i] << endl; } cout << sizeof(szSymbols) << endl; //gives 30(2), 60 (1) cout << sizeof(pszSymbols) << endl; //gives 20 return 0; }