Gudday all
I wish to left shift a string by one char to remove a leading '\'. In concept it seems simple enough but I flounder on the strings handling still esp. initialisation, pointers etc:
The error I get isCode:#include <stdio.h> #include <string.h> #include <io.h> #include <stdlib.h> #include <cstring> int main(int argc, char *argv[]) { size_t size = 14; char *dst[size]= {0}; char *src[size+1] = "\0000544D.TIF"; while (size != 0) { dst[size] = src[size-1]; size--; } }
It must be staring me in the face but I have lost it.C:/ScanImages/leftShiftACharacter.cpp: In function `int main(int, char**)':
C:/ScanImages/leftShiftACharacter.cpp:13: error: variable-sized object `dst' may not be initialized
C:/ScanImages/leftShiftACharacter.cpp:14: error: variable-sized object `src' may not be initialized
I really find strings and pointers to be very challenging. Is there a good on-line reference that is not too rocket science?



LinkBack URL
About LinkBacks




