Loading, please wait...

A to Z Full Forms and Acronyms

C program to create SQLite database dynamically in Linux | C programming

Jun 24, 2021 C programming, 434 Views
C program to create SQLite database dynamically in Linux | C programming

C program to create SQLite database dynamically in Linux | C programming

Prerequisites:

sudo apt install sqlite3
sudo apt install gcc
sudo apt install libsqlite3-dev

In this program, we will create a database using the sqlite3_open() function dynamically in Linux.

#include <sqlite3.h>
#include <stdio.h>

int main(void)
{
    sqlite3* db_ptr;
    int ret = 0;

    ret = sqlite3_open("MyDb.db", &db_ptr);

    if (ret == SQLITE_OK) {
        printf("Database created successfully\n");
    }

    sqlite3_close(db_ptr);

    return 0;
}
A to Z Full Forms and Acronyms

Related Article