I am learning some new things and get stuck on a simple strcpy operation. I don't understand why first time when I print works but second time it doesn't. #include #include #include int main() { char *name; char *altname; name=(char *)malloc(60*sizeof(char)); name="Hello World!"; altname=name; printf("%s \n", altname); altname=NULL; strcpy(altname,name); printf("%s \n", altname); return 1; } Solved You need to allocate memory for altname : #include #include #include int main() { char *name; char *altname; name=(char *)malloc(60*sizeof(char)); name="Hello World!"; altname=name; printf("%s \n", altname); altname=NULL; // allocate memory, so strcpy has space to write on ;) altname=(char *)malloc(60*sizeof(char)); strcpy(altname,name); printf("%s \n", altname); return 1; } The problems star...
Trying to write some Jasmine tests for my React App, and getting this error: import HomePage from '../../src/components/home/HomePage'; ^^^^^^SyntaxError: Unexpected token import at Object.exports.runInThisContext (vm.js:76:16) at Module._compile (module.js:542:28) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object.jasmine.executeSpecsInFolder (C:\Users\JasmineTest\node_modules\jasmine-node\lib\jasmine-node\index.js:160:9) at Object. (C:\Users\JasmineTest\node_modules\jasmine-node\lib\jasmine-node\cli.js:248:9) Using React, Babel-loader, webpack. Only gives error if i try to import component, or if i use required('component') and in component i use Import. Solved Here is my webpack file import webpack from 'webpack'; import path from 'path';...