Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ C ++ pointer two third memory model     - Ubuntu Install OpenSSL (Linux)

- Oracle 10046 Event (Database)

- Upgrade to Linux Mint 16 petra Mint 17 Qiana (Linux)

- Tsung first test installation (Linux)

- Apache Spark1.1.0 deployment and development environment to build (Server)

- Video editing captions under Linux (Linux)

- WEB-based Android Remote Tools Python implementation (Programming)

- Linux batch copy data script (Linux)

- shell script error dirname: invalid option - b (Database)

- Linux smart small switch rfkill (Linux)

- CentOS 6.5 installation and deployment SVN 1.8.10 (Linux)

- File permissions under Linux (Linux)

- Linux, Firefox unloading and installation and upgrade (Linux)

- How to run Docker client in Windows operating system (Linux)

- Vagrant Getting Start (Linux)

- To access an Oracle database using Instant Client (Database)

- Oracle 11g on Linux system boot from the startup settings (Database)

- Shuffle Process Arrangement in MapReduce (Server)

- Build a Linux development environment under STC89C52RC (Linux)

- pga_aggregate_target and _pga_max_size can not use absolute limit actual PGA (Database)

 
         
  C ++ pointer two third memory model
     
  Add Date : 2017-08-31      
         
       
         
  C ++ pointer two third memory model

#include "stdio.h"
#include "stdlib.h"
#include "string.h"
void main ()
{
    int i = 0, j = 0;
    char buf [100];
    char ** myarray = (char **) malloc (10 * sizeof (char *)); // int array [10]
    if (myarray == NULL)
    {
        return;
    }
    for (i = 0; i < 10; i ++)
    {
        myarray [i] = (char *) malloc (100 * sizeof (char)); // char buf [100];
        if (myarray [i] == NULL)
        {
            printf ( "ddddde \ n");
            return;
        }
        sprintf (myarray [i], "% d% d% d", i, i, i);
    }

    // Third memory model Print
    printf ( "Before sorting \ n");
    for (i = 0; i < 10; i ++)
    {
        printf ( "% s \ n", myarray [i]);
    }

    // Sort
    for (i = 0; i < 10; i ++)
    {
        for (j = i + 1; j < 10; j ++)
        {
            if (strcmp (myarray [i], myarray [j]) < 0)
            {
                strcpy (buf, myarray [i]);
                strcpy (myarray [i], myarray [j]);
                strcpy (myarray [j], buf);
            }
        }
    }

    // Third memory model Print
    printf ( "After sorting \ n");
    for (i = 0; i < 10; i ++)
    {
        printf ( "% s \ n", myarray [i]);
    }

    for (i = 0; i < 10; i ++)
    {
        free (myarray [i]);
    }
    if (myarray! = NULL)
    {
        free (myarray);
    }

    system ( "pause");
}

 

#include "stdio.h"
#include "stdlib.h"
#include "string.h"
int printfArr33 (char ** ArrayStr, int iNum)
{
    int i = 0;
    for (i = 0; i < iNum; i ++)
    {
        printf ( "% s \ n", ArrayStr [i]);
    }
    return 0;
}

int sortArrayStr03 (char ** ArrayStr, int iNum)
{
    int i = 0, j = 0;
    char * tmp = NULL;
    // Sort

    for (i = 0; i < iNum; i ++)
    {
        for (j = i + 1; j < iNum; j ++)
        {
            if (strcmp (ArrayStr [i], ArrayStr [j]) < 0)
            {
                tmp = ArrayStr [i];
                ArrayStr [i] = ArrayStr [j];
                ArrayStr [j] = tmp;
            }
        }
    }
    return 0;
}

void main ()
{
    int i = 0, j = 0;
    char buf [100];
    char ** myarray = (char **) malloc (10 * sizeof (char *)); // int array [10]
    if (myarray == NULL)
    {
        return;
    }
    for (i = 0; i < 10; i ++)
    {
        myarray [i] = (char *) malloc (100 * sizeof (char)); // char buf [100];
        if (myarray [i] == NULL)
        {
            printf ( "ddddde \ n");
            return;
        }
        sprintf (myarray [i], "% d% d% d", i, i, i);
    }

    // Third memory model Print
    printf ( "Before sorting \ n");
    printfArr33 (myarray, 10);

    sortArrayStr03 (myarray, 10);

    // Third memory model Print
    printf ( "After sorting \ n");
    printfArr33 (myarray, 10);

    for (i = 0; i < 10; i ++)
    {
        free (myarray [i]);
    }
    if (myarray! = NULL)
    {
        free (myarray);
    }

    system ( "pause");
}
     
         
       
         
  More:      
 
- VMware difference in three network connection (Linux)
- Eclipse, Tomcat configuration JNDI connection Oracle data source example (Server)
- Unable to start the network after restart clone a virtual machine (Linux)
- Use Vagrant build cross-platform development environment for Python (Server)
- VirtualBox CentOS is configured as a local disk mirroring software source (Linux)
- Java Class file format parsing (Programming)
- MySQL loose index scan (Database)
- Recover Ubuntu 14.04 wakes up from standby in case mouse keyboard appears dead (Linux)
- Java, on the dfile.encoding Systemproperty (Programming)
- The Samba service does not have permission to access (Server)
- Security matters and practical Linux System (Linux)
- W and uptime command (Linux)
- CentOS static IP network configuration (Linux)
- Using IE can also be easily remotely control the computer (Linux)
- Linux compiler of GCC (Linux)
- Linux RHCS basic maintenance commands (Linux)
- 20 Unix / Linux command skills (Linux)
- C ++ inline functions (Programming)
- Java keyword final, static (Programming)
- Java programmers talk about those advanced knowledge and direction (Programming)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.