Hello, I am working on a new screen for a program used by the U.S. Department of Labor. I am getting a signal SEGV (access to address exceeded protections) when I try to excute the command snprintf(rowh[1] + 30, 4, "%4d", baseyr + 1);. The string I am trying to copy into is declared char *rowh[] = {"Percent average annual wage from prior year =>","Maximum taxable wage base for YYYY =>","Percent average annual wage from second prior year =>"};
The snprintf statement is attempting to overwrite the YYYY in the second string declared in the rowh array. The base year + 1 value is 2014, which is what I want to appear instead of YYYY. Since the string is declared, and I am attempting to overwrite a portion of that string, I do not understand why I am getting a stack overflow, which is what this error indicates is happening. I have tried using the command sprintf(rowh[1], "%4d", baseyr + 1); instead, but I get the same error. The screen this code is in is a standalone program, and does not have that many variables declared, so there is not any good reason for it to run out of memory. Any help with this problem is appreciated.