sunil_h_v wrote:
> hey guys why dont you use pointers???
> i tried it works fine with me
> 
> #include <stdio.h>
> #include <conio.h>
> #include <string.h>
> #include <alloc.h>
> void fun(char **arr)
> {
>   printf("%s\n",arr[0]);
>   printf("%s\n",arr[1]);
> }
> void main()
> {
>   char **arr;
>   clrscr();
>   strcpy(arr[0],"1asdf");
>   strcpy(arr[1],"2sdf");
>   fun(arr);
>   getch();
> }

Because most of us have realized the benefits of C++ and don't really 
mess with anything but pass-by-address any more and use high level 
templates/classes that cover over the messy stuff.

What's really amazing is your program didn't crash, wipe your hard 
drive, display gobbledygook, or complain that your compiler is ancient 
and you should upgrade*.  You are dereferencing memory that hasn't been 
allocated with malloc().

* You need to find a new compiler.  TC 3 is ancient.  Both Microsoft and 
Borland are giving away their latest stuff (albeit slightly cut down - 
but _way_ more functionality than you are using right now).

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* VerifyMyPC 2.4
Change tracking and management tool.
Reduce tech. support times from 2 hours to 5 minutes.

http://www.CubicleSoft.com/VerifyMyPC/

Reply via email to