Search:

Type: Posts; User: ylzhang

Search: Search took 0.00 seconds.

  1. Replies
    6
    Views
    3,255

    Ohh-- it's a typo-- Yes, it should be ...

    Ohh-- it's a typo-- Yes, it should be

    iptout=(long int)p;

    Thank you!! The program now gave me correct result!!!
  2. Replies
    6
    Views
    3,255

    Yes, I wrote a test fortran77 code which calls...

    Yes, I wrote a test fortran77 code which calls mallocf, here are both codes and a makefile:



    </bigscr/TEMP/temp_FC> cat testProgram.f
    program test
    integer MAX,BYTES_PER_INT
    ...
  3. Replies
    6
    Views
    3,255

    This is my question too! However, these C codes...

    This is my question too! However, these C codes were specifically written (by a C expert I suppose) to allocate memory
    for a collection of Fortran77 codes. And I have no idea of the intention of...
  4. Replies
    6
    Views
    3,255

    I type casted the malloc as well as included...

    I type casted the malloc as well as included <stdlib.h>, but the code crashed in the same place:

    (/opt/SUNWspro/bin/../WS6U2/bin/sparcv9/dbx) p iptout
    iptout = 4295023136...
  5. Replies
    6
    Views
    3,255

    After I included stdlib.h in the module defining...

    After I included stdlib.h in the module defining mallocf_(), and compile, I got:

    cc -g -xarch=v9a mmsc.c -c
    "mmsc.c", line 11: warning: improper pointer/integer combination: op "="

    I'm...
  6. Replies
    6
    Views
    3,255

    No -- there are neither prototypes for malloc(),...

    No -- there are neither prototypes for malloc(), nor for mallocf_() in either the module which contains mallocf_() or in the module (mm2000.f) which calls mallocf_(). I actually considered this a...
  7. Replies
    6
    Views
    3,255

    malloc problem in SUN in 64-bit compilation

    Hi, I have a fortran77 program calling a C program to do memory allocation, and it compiled and ran fine under SUN's 32-bit environment. But when I compiled and ran under 64-bit, the code
    has...
  8. uncertainty in order of execution - any explanation?

    I have a piece of code which prints the values and addresses of a 2D array:



    #include<stdio.h>

    int main(void)
    {
    /* declare array[3][4] which is stored contigurously in memory */
    int...
  9. Replies
    3
    Views
    1,860

    What's wrong with this code?

    /*
    #include<stdio.h>

    struct msg{
    char *p1;
    char *p2;
    char *p3;
    }mymsg;

    mymsg.p1="Teach yourself C in 21 days!";
  10. Replies
    9
    Views
    946

    Sorry... the tab key accidetally submits the last...

    Sorry... the tab key accidetally submits the last post....



    #include<stdio.h>

    main()
    {

    /* int c_A,c_a,c_return; */
  11. Replies
    9
    Views
    946

    Code reposted: #include main()...

    Code reposted:



    #include<stdio.h>

    main()
    {

    /* int c_A,c_a,c_return; */
  12. Replies
    9
    Views
    946

    Just to test how to use code tags: ...

    Just to test how to use code tags:



    #include<stdio.h>
    main()
    {
    int i;
    int j;
    i=0; j=1;
  13. Thread: malloc problem

    by ylzhang
    Replies
    18
    Views
    3,916

    Is there any good reason to do address...

    Is there any good reason to do address arithmatics instead of pointer arithmatics? Or is it always preferable to do pointer arithmatics?

    What is the bit length a unique memory address occupies --...
  14. Replies
    9
    Views
    946

    I wrote a code to try to understand...

    I wrote a code to try to understand char/string/int:

    #include<stdio.h>

    main()
    {

    /* int c_A,c_a,c_return; */
    char c_A, c_a, c_return; /* characters - each 1 byte */
  15. Thread: malloc problem

    by ylzhang
    Replies
    18
    Views
    3,916

    Thanks for the reply. I just learned C last week...

    Thanks for the reply. I just learned C last week following a tutorial - there is still much more to learn before I can properly understand these pointer problems. For example,

    char *p;
    char x;...
  16. Thread: malloc problem

    by ylzhang
    Replies
    18
    Views
    3,916

    "You mean "why have Fortran code call into C code...

    "You mean "why have Fortran code call into C code when Fortran has its own version of malloc and malloc64?" - good question."

    Exactly! The code that I'm trying to make it work for a 64-bit Solar...
  17. Thread: malloc problem

    by ylzhang
    Replies
    18
    Views
    3,916

    Yes, you're right -- the nwords is indeed...

    Yes, you're right -- the nwords is indeed misleading -- it's someone else's code which I don't want to change the variable names. In case I get to talk to the person who wrote it ...

    I thought I...
  18. Thread: malloc problem

    by ylzhang
    Replies
    18
    Views
    3,916

    malloc problem

    Hi, I need to modify a set of codes (f77, f90 and c codes) for the 64-bit archtecture on Sun (SPARC v9) in a 64-bit Solaris operating environment. So, C data type may need conversion, for example,
    ...
Results 1 to 18 of 18