[ create a new paste ] login | about

Link: http://codepad.org/2Sswt55g    [ raw code | output | fork ]

C++, pasted on Nov 22:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>

using namespace std;
struct TEST
{
  char arr[20];
  int var;
};

void foo(char * arr){
  strncpy(arr, "Goodbye,", 8);
}

int main () {
TEST test;
strcpy(test.arr, "Hello,   world");
cout << "before: " << test.arr << endl;
foo(test.arr);
cout << "after: " << test.arr << endl;
}


Output:
1
2
before: Hello,   world
after: Goodbye, world


Create a new paste based on this one


Comments: