05-13 01:49
Notice
Recent Posts
Recent Comments
관리 메뉴

Scientific Computing & Data Science

[C/C++] Example / Dynamic Array 본문

Programming/C&C++

[C/C++] Example / Dynamic Array

cinema4dr12 2014. 6. 12. 10:14

//
//  main.cpp
//  Test-001
//
//  Created by gchoi on 2014. 4. 30..
//  Copyright (c) 2014년 gchoi. All rights reserved.
//

#include <iostream>
#include <string>

using namespace std;

int main( int argc , const char * argv [])
{
    int *p = new int;
   
    for(int i = 0 ; i < 40 ; i++) {
        *(p+i) = i + 1;
    }
   
    for(int i = 0 ; i < 40 ; i++) {
        cout << "p[" << i << "] = " << *(p+i) << endl;
    }
   
    delete p;
   
    return 0 ;
}

'Programming > C&C++' 카테고리의 다른 글

[C/C++] Example / Class  (0) 2014.06.12
[C/C++] Example / Pointer of Structure  (0) 2014.06.12
[C/C++] Example / Structure  (0) 2014.06.12
[C/C++] Example / swap: call by pointer  (0) 2014.06.12
[C/C++] Example / swap: call by reference  (0) 2014.06.12
Comments