עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

בעיה לא מובנת

Featured Replies

פורסם

#include <stdio.h>
#include <stdlib.h>


int get_newsize_CAP(char arr[]){
int i;
int newsize=0;
for(i=0;arr[i]!='/0';i++)
if (arr[i]>'64' && arr[i]<'91')
newsize++;
return newsize;


}
int get_newsize_small(char arr[]){
int i;
int newsize=0;
for(i=0;arr[i]!='/0';i++)
if (arr[i]>'96' && arr[i]<'123')
newsize++;
return newsize;
}


void char_split(char A[],int sizeA,char **B,char **C)
{
int sizeB = get_newsize_CAP(A);
int sizeC = get_newsize_small(A);
int i,j=0,k=0;




*B = (char*)calloc(sizeB,sizeof(char));
*C = (char*)calloc(sizeC,sizeof(char));


for(i=0;i<sizeA;i++)
{
if (A[i]>'64' && A[i]<'91')
{
(*B)[j]=A[i];
j++;
}
else if (A[i]>'96' && A[i]<'123')
{
(*C)[k]=A[i];
k++;
}
}











}
int main () {
char A[] = "aAfdsfFSDFGHdfg"; // + '/0' --> size +1
int sizeA = sizeof(A)/sizeof(A[0]);
char *B;
char *C;
int *sizeB;
int *sizeC;
int i;

char_split(A,sizeA,&B,&C);
for(i=0;A[i]!='/0';i++)
printf("%c ",B[i]);
printf("\n\n");


for(i=0;A[i]!='/0';i++)
printf("%c ",C[i]);
printf("\n\n");


printf("ADDRESS B: %d || ADDRESS C: %d\n\n",&B,&C);


free(B);
free(C);



return 0;
}

אני לא מצליח להבין מה הבעיה, כאשר אני עושה דיבאג אני מגיע לקריאה לפונקציה עבור sizeB ...

התוכנית יוצרת פונקציה שמקבלת מערך תווים, מפצלת אותו לשני מערכים דינאמיים שאחד יכיל את האותיות הגדולות והשני את האותיות הקטנות.

אני מנסה לקבל גודל עבור המערך הדינאמי החדש שאני יוצר ושם מתעוררת הבעיה.

אשמח לעזרה תודה רבה

- - - תגובה אוחדה: - - -

Unhandled exception at 0x00E8163D in ProjectTest.exe: 0xC0000005: Access violation reading location 0x00374000.

זה השגיאה... וזה קורה בתוך get_newsize_CAP כאשר מתחילה הלולאה

פורסם

תערוך בבקשה את הכותרת כך שתכיל את תמצית השאלה והשפה שבה אתה כותב.

השגיאה עצמה אומרת שאתה מנסה לגשת לזכרון לא חוקי. כלומר אתה חורג מגבולות מערך, או מנסה להשתמש במצביע שמצביע לזכרון לא מוקצה.

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.