Search Results

Search found 4 results on 1 pages for 'riyaz'.

Page 1/1 | 1 

  • extern and static variable storage ???

    - by Riyaz
    when will memory created for extern and static variable. Is it in stack or heap. Since its life time is till the program end, it cant be in stack it must be in heap. But size of the heap will known only at the run time. So somewhat confusion here ......

    Read the article

  • how free of memory happen in this case???

    - by Riyaz
    #include <stdio.h> void func(int arr[],int xNumOfElem) { int j; for(j=0; j<xNumOfElem; j++) { arr[j] = j + arr[j]; printf("%d\t",arr[j]); } printf("\n"); } int main() { int *a,k; a = (int*) malloc(sizeof(int)*10); for(k = 0; k<10; k++) { a[k] = k; printf("%d\t",a[k]); } printf("\n"); func(a,10); //Func call free(a); } Inside the the function "func" who will allocate/deallocate memory for dynamic array "arr". arr is an function argument.

    Read the article

  • UIImage Object surprisingly returning null but not NSData

    - by riyaz
    i have created a sqlite db. and i have insert a few datas in my db.. UIImage * imagee=[UIImage imageNamed:@"image.png"]; NSData *mydata=[NSData dataWithData:UIImagePNGRepresentation(imagee)]; const char *dbpath = [databasePath UTF8String]; NSString *insertSQL=[NSString stringWithFormat:@"insert into CONTACTS values(\"%@\",\"%@\")",@"Mathan",mydata]; NSLog(@"mydata %@",mydata); sqlite3_stmt *addStatement; const char *insert_stmt=[insertSQL UTF8String]; if (sqlite3_open(dbpath,&contactDB)==SQLITE_OK) { sqlite3_prepare_v2(contactDB,insert_stmt,-1,&addStatement,NULL); if (sqlite3_step(addStatement)==SQLITE_DONE) { sqlite3_bind_blob(addStatement,1, [mydata bytes], [mydata length], SQLITE_TRANSIENT); NSLog(@"Data saved"); } else{ NSLog(@"Some Error occured"); } sqlite3_close(contactDB); } else{ NSLog(@"Failure"); } have written some codes to retrive the data sqlite3_stmt *statement; if (sqlite3_open([databasePath UTF8String], &contactDB) == SQLITE_OK) { NSString *sql = [NSString stringWithFormat:@"SELECT * FROM contacts"]; if (sqlite3_prepare_v2( contactDB, [sql UTF8String], -1, &statement, nil) == SQLITE_OK) { while (sqlite3_step(statement) == SQLITE_ROW) { char *field1 = (char *) sqlite3_column_text(statement, 0); NSString *field1Str = [[NSString alloc] initWithUTF8String: field1]; NSLog(@"UserName %@",field1Str); NSData *data = [[NSData alloc] initWithBytes:sqlite3_column_blob(statement, 1) length:sqlite3_column_bytes(statement, 1)]; UIImage *newImage = [[UIImage alloc]initWithData:data]; NSLog(@"Image OBJ %@",newImage); NSLog(@"Image Data %@",data); } sqlite3_close(contactDB); } } sqlite3_finalize(statement); the problem is in log, inserted NSData object and retrieved NSData Objects are different (printing in log gives different stream) moreover Image OBJ is printed null in log.. Have seen similar questions in stackoverflow. But nothing seems to help. Please give some suggestions to overcome this issue.

    Read the article

1