ping@cubmol.bio.columbia.edu (Shiping Zhang) (02/01/90)
In article <1990Jan31.165428.2538@cubmol.bio.columbia.edu> ping@cubmol.bio.columbia.edu (Shiping Zhang) writes: >In article <931@christopher-robin.cs.bham.ac.uk> cjr@uk.ac.bham.cs (Chris Ridd <RiddCJ>) writes: >>I have the following declarations in an image enhancing program: >>typedef unsigned char u_char; >>char ang[512][512]; > ^^^^ >ang is declared as char instead u_char. >>void imgsave(char *filename, u_char img[512][512]) >>{ >>... >>} >> imgsave("filename", ang); >>The GCC compiler gives (correctly) a warning on the imgsave call, saying >>incompatible pointer types (or something similar). What should the cast be >>to correct this? I have tried: >>(u_char (*)[512][512])ang, >>((u_char *)[512][512])ang, >> etc... >The casting should be following: > u_char (*img)[512] Someone pointed out to me that it is a declare instead of cast. He is right. The cast should be (u_char (*)[512])img Sorry for the wrong information. By the way, the problem of the original poster is probably caused by declaring ang as char instead u_char, unless it is the auther's intention. It is not necessary to cast ang when it is used as the second argument of imgsave() if the declaration is consistant. >-ping -ping