language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/wait.h>
#include <fsdyn/integer.h>
#include "unixkit.h"
int main()
{
list_t *open_fds = unixkit_get_open_fds();
assert(open_fds);
list_elem_t *elem = list_get_first(open_fds);
while (elem) {
int fd = as... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | /************************************************************************
Copyright (c) IPADS@SJTU 2021. All rights reserve.
This file contains the pseudo-random generator provided by PENGLAI sdk.
It is used to generate 'seed' for SM2, and it can be used to generate
'key' and 'iv' for SM4.
Function List:
... |
C | //
// 2021 Spring - Automata and Formal Languages (03)
// Homework #1: Building a DFA simulator that accepts strings with prefix bbab
//
// Copyright (c) Prof. Jaehyeong Sim
// Department of Computer Science and Engineering, Ewha Womans University
//
#include <stdio.h>
#define MAX_NUM_STATES 10
#define MAX_NUM_INPUTS... |
C | #include "stdio.h"
// return a string with func
char *getName(void);
int main()
{
char *name;
name = getName();
printf("%s %p\n", name);
return 0;
}
char *getName(void)
{
char *name = "Hello";
printf("%p\n", name);
char name1[10] = {'H','e','l','l','o'... |
C | /*H********************************************************************************/
/*!
\File plat-time.c
\Description
This module implements variations on the standard library time functions.
The originals had a number of problems with internal static storage,
bizarre parameter passin... |
C | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
/**
* main - Entry point
* @argc: int parameter, argumennt count
* @argv: double pointer, argument strings
* Return: void, print change
*/
int main(int argc, char *argv[])
{
char *sum = argv[argc - 1];
int num = 0;
int val[] = {25, 10, 5, 2, 1};
int count =... |
C | #include<stdio.h>
int main()
{
int i,j,n,a[12]={4,7,47,74,447,474,744,747,774,477},l,cnt=0;
scanf("%d",&n);
for(i=0;i<10;i++){
if(n%a[i]==0) {
printf("YES\n");
break;
}
else cnt++;
}
if(cnt==10) printf("NO\n");
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstiter_main.c :+: :+: :+: ... |
C | #include <stdio.h>
#include "add.h"
int main(int argc, char *argv)
{
int sum;
int num1, num2;
num1 = num2 = 20;
sum = add(num1, num2);
printf("Sum of %d and %d is %d\n", num1, num2, sum);
} |
C | #ifndef __UTILITY_IMPL_H__
#define __UTILITY_IMPL_H__
#include "utility.h"
TCHAR toLowerCase(TCHAR c)
{
if (c > 64 && c < 91)
c += 32;
return c;
}
void writeTextFile(LPCTSTR lpszPath, LPCTSTR lpszBuf, BOOL bAppend)
{
FILE * pFile;
pFile = (bAppend) ? (fopen(lpszPath, "a")) : (fopen(lpszPath, "w+"));
if ... |
C | /* bsearch function */
#include "stdlib.h"
void *bsearch(const void *key, const void *base,
size_t nelem, size_t size, _Cmpfun *cmp)
{ /* search sorted table by binary chop */
const char *p;
size_t n;
for (p = (const char *)base, n = nelem; 0 < n;) {
/* check midpoint of whatever is left */
... |
C | #include <stdio.h>
void makesum(int n, int k, int ans[], int t) {
int i;
if (k == 0) {
return;
}
if (k == 1) {
ans[k] = n;
for (i = 1; i <= t; i++) {
printf("%d ", ans[i]);
}
puts("");
}
for (i = 1; i <= k; i++) {
ans[k] = i;
makesum (n - i, k - 1, ans, t);
}
}
int main() {
int input_n... |
C | #include "session.h"
enum LoginUserStatus loginUser (struct sockaddr_in *cliaddr, char *id) {
Session *ss = findBySessionCliaddr(cliaddr);
if (ss == NULL || ss->status == USER_BLOCKED) return -1;
else if (ss->status == NOT_AUTHENTICATED || ss->status == AUTHENTICATED) return LU_EXISTED_ONE_USER;
... |
C | #include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#define F_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
static struct flock lock_it, unlock_it;
static int lock_fd = -1;
void my_lock_init(char *path)
{
struct stat st;
int... |
C | #include "../framework.h"
#define IMAGES 10
#include "images/digits6.c"
//const uint8_t COLORS[IMAGES] = {
// 0b111111, //0
// 0b110110, //1
// 0b001111, //2
// 0b110011, //3
// 0b001011, //4
// 0b000011, //5
// 0b001100, //6
// 0b010111, //7
// 0b110100, //8
// 0b111100, //9
//};
const uint8_t COLORS[IMAG... |
C | #include "image.h"
#include "memory.h"
#include "plugin.h"
#include "context.h"
#include "log.h"
#include "format.h"
#include <string.h>
#include <assert.h>
#include <stdio.h>
static bool validate_image(ImgloadImage img)
{
if (!img->data_format_initialized || !img->compression_initialized)
{
print_to_... |
C | #include<stdio.h>
void main()
{
int arr[20],i,n,max1=0,max2=0;
printf("enter size of array\n");
scanf("%d",&n);
printf("enter the elements of array\n");
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
for(i=0;i<n;i++)
{
if(arr[i] > max1)
{
max1 = arr[i];
}
else if(arr[i] > max2 && arr[i] < max1)
{
... |
C | #include<stdio.h>
int add(int,int);
int sub(int,int);
int mul(int,int);
int div(int,int);
int main()
{
int a,b,addition,subract,multi,division;
printf("Enter a and b value:\n");
scanf("%d %d",&a,&b);
printf("\n");
addition=add(a,b);
subract=sub(a,b);
multi=mul(a,b);
division=div(a,b);
... |
C | void rotate(int **matrix, int matrixRowSize, int matrixColSize)
{
int up, down, left, right, len, i, t;
up = 0;
down = matrixRowSize - 1;
left = 0;
right = matrixColSize - 1;
while (up < down && left < right) {
len = right - left;
for (i = 0; i < len; i++) {
t = matrix[down - i][left];
matrix[down - i]... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <pthread.h>
#include <assert.h>
#include <unistd.h>
#include "./paging.h"
#include "./memory.h"
#include "./util.h"
struct process_startup_args {
int pid;
int nloop;
};
// test address
#define BASE_USER_SPACE_ADDRESS 0x100000000000
static void *p... |
C | #include "unp.h"
#define MAXLINE 4096
#define SA struct sockaddr
int main(int argc, char **argv){
/*
send message to parent, indicating that the xterm is processing....
*/
/*
here every message which user needs to read, needs to be sent through
pipe. Here, 3 is for pipe's write ... |
C | /*
* Copyright 2002-2011, The TenDRA Project.
* Copyright 1997, United Kingdom Secretary of State for Defence.
*
* See doc/copyright/ for the full copyright terms.
*/
#include <string.h>
#include <shared/error.h>
#include <shared/string.h>
#include "calculus.h"
#include "code.h"
#include "common.h"
#include "le... |
C | typedef struct Personne{
char* nom;
char* prenom;
char* sexe;
int nbr_enfant;
char** enfants;
char* id;
struct Personne* suivant;
}Personne;
void afficherMenu(){
printf(" *** Gestion de personnel ***");
printf("\n\n 1- Ajouter un... |
C |
#include <stdio.h>
int a=2,b=3,c=6,d=7;
void func (int **p) {*p = &b;}
void main()
{
int *ptrA = &a;
int *ptrB = &b;
int **ptrC;
int **ptrD;
printf("If we set **ptr, we consider as two level pointer\n");
printf(" ----------- \n");
printf(" | C | context: c value, *pt... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <cs50.h>
typedef uint8_t BYTE;
int main(int argc, char *argv[])
{
//Ensure proper usage.
if (argc != 2)
{
fprintf(stderr, "Usage: ./recover image\n");
return 1;
}
//Get in the image file.
... |
C | #include<stdio.h>
#include<stdlib.h>
#include<conio.h>
struct Node{
int data;
struct Node* prev;
};
int push(int data);
int pop(void);
struct Node* tos;
struct Node * createNode(int data);
void printStack();
int main(){
char press;
int tmp;
printf("1- Push\n");
printf("2- Pop\n");
printf("... |
C | #include<stdio.h>
int main(){
int x,y;
scanf("%d",&x);
y=x<<1;
printf("%d\n",y);
}
|
C | #include <stdio.h>
#include "variadic_functions.h"
/**
*printch - prints a character
*@list: the va_list or arguments that passed a function
*Return: nothing
*/
void printch(va_list list)
{
printf("%c", va_arg(list, int));
}
/**
*printin - prints an integers
*@list: the va_list or arguments that passed a func... |
C | #include "mysockfunctions.h"
#include <stdint.h>
#define LISTENQ 10
#define MAXLINE 10000
int main (int argc, char **argv) {
int listenfd, connfd, n;
struct sockaddr_in servaddr;
char recvline[MAXLINE + 1];
listenfd = Socket(AF_INET, SOCK_STREAM, 0);
bzero(&servaddr, sizeof(servaddr)); // i... |
C | /* BEGIN main */
/* C Program to create the random-access file for the RandomAccessFile example
* Ian F. Darwin, http://www.darwinsys.com/
*/
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <machine/endian.h>
const off_t OFFSET = 1234; // off_t is a C... |
C | #include <stdio.h>
#include <stdlib.h>
#include "definizioni.h"
int main ()
{
int i, j;
int somma;
printf ("Hello world....\n");
printf ("Digita il primo numero:");
scanf ("%d", &i);
printf ("Digita il seondo numero:");
scanf ("%d", &j);
somma = operazione_somma (i,j);
printf ("la somma è: %d\n", somma);
retur... |
C | /*
** EPITECH PROJECT, 2018
** Projet MINISHELL2
** File description:
** function for treat str with fork
*/
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "my.h"
#include "myinc.h"
#include "struct.h"
int my_check_str(char *str)
{
int i = 0;
for (; str[i]; ++i) {
if (str[i] == '/')
retu... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_tools2.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include "Random.h"
int main(int argc, char *argv[]) {
int* randomArr;
randomArr = getRandom(5,300,RANDOM_SIZE);
int i;
for(i=0;i<RANDOM_SIZE;i++)
printf("[%d]%d\n",i,randomArr[i]);
return 0;
}
|
C |
# include<stdio.h>
void main()
{
int i=0, j=0;
char str[10];
int flag=0;
clrscr();
printf("Enter string");
scanf("%s", str);
while(str[i]!=NULL)
{
i++;
}
i--;
while (j!=i)
{
if (str[i]==str[j])
{
flag=1;
}
else
{
flag=2;
break;
}
j++;
i--;
}
if (flag==1)
{
printf("%s is palindrom",str);
}
else
{
printf("%s is not pali... |
C | //**********************************************************************
//
// Copyright (c) 2004
// PathEngine
// Lyon, France
//
// All Rights Reserved
//
//**********************************************************************
//#ifndef CLIB_STDLIB_INCLUDED
//#define CLIB_STDLIB_INCLUDED
//
//inline long
//strtol(c... |
C | #ifndef lint
#ifdef sccs
static char sccsid[] = "@(#)expandpath.c 20.16 93/06/28 SMI";
#endif
#endif
/*
* (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents
* pending in the U.S. and foreign countries. See LEGAL NOTICE
* file for terms of the license.
*/
/*
* Sun Microsystems, Inc.
*/
/*-
Han... |
C | #include <stdio.h>
int main()
{
double a,b,c,tri,d,e;
scanf("%lf%lf%lf",&a,&b,&c);
tri=((a*c)/2);
printf("%lf\n%lf\n%lf",d,e,tri);
return 0;
}
|
C | // The reader first solution to the readers and writers problem.
// As long as there are readers in existence, upcoming writers cannot start.
// Writers may starve.
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <semaphore.h>
// Total number of readers and writers.
#define NUMBER_OF_THREADS 1000... |
C | #include <stdio.h>
#include <string.h>
#include "object.h"
#include "misc.h"
struct location {
const char *description;
const char *tag;
}
locs[] = {
{"an open field", "field"},
{"a little cave", "cave"}
};
#define numberOfLocations (sizeof(locs) / sizeof(*locs))
static unsigned locationOfPlayer = 0;
void execu... |
C | #include "main.h"
#include "Arrays_Queue.h"
int main()
{
QUEUE Que;
int pVal ;
Queue_Init(&Que,10); /* 队列初始化 */
Enter_Queue(&Que, 7);
Enter_Queue(&Que, 8);
Enter_Queue(&Que, 12); /* 入队 */
Queue_Traverse(&Que); /* 遍历队列 */
Out_Queue(&Que, &pVal); /* 出队 */
Queue_Traverse(&Que); ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* stack_draw_term.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int age;
printf("what is your age shambhu?\n");
scanf("%d",&age);
if (age > 20)
{
printf("timi ta budo vaechau yarr\n");
}
if (age < 20)
{
printf("kancho raichau yarr\n");
}
if (age == 40)
{
printf("aba ta bu... |
C | #include<stdlib.h>
struct stack
{
char data;
struct stack* link;
};
struct stack *top=NULL,*temp;
void push(char data)
{
temp=(struct stack*)malloc(1*sizeof(sizeof(struct stack)));
if(top==NULL)
{
temp->link=NULL;
top=temp;
}
else
{
temp->link=top;
top=tem... |
C | #include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#define BUFSIZE 1024
void error_exit(char *message);
int main(int argc, char **argv) {
int client_fd;
char message[BUFSIZE];
int str_len, ret;
struct sockaddr_in ser... |
C | /*
* Block Cipher Modes of Operation
* @author Dani Huertas
* @email huertas.dani@gmail.com
*
*/
#include "pcbc.h"
static uint8_t *tmp = NULL;
size_t pcbc(blockcipher_fn cipher, uint8_t direction,
uint8_t *in,
uint8_t *out,
uint8_t *iv,
uint8_t *key,
size_t key_size,
size_t block_size,
size_t lengt... |
C | /* CS261- HW1 - Program4.c*/
/* Name:
* Date:
* Solution description:
*/
#include <stdio.h>
#include <stdlib.h>
struct student{
char initials[2];
int score;
};
void sort(struct student* stud, int n){
/*Sort n studdents based on their initials*/
if(n==0)
return;
struct student temp;
int i, j;
... |
C | //sum of elements in zig zag sequence in given matrix
/*1 2 3
4 5 6
7 8 9*/
#include<stdio.h>
#include<stdlib.h>
int main()
{
int r,c,arr[100][100],i,j,sum=0;
printf("enter no. of rows and columns:\n");
scanf("%d%d",&r,&c);
if(r!=c)
{
printf("zig zag sum not possible");
exit(1);
}
print... |
C | #ifndef FUNCIONES_H_INCLUDED
#define FUNCIONES_H_INCLUDED
float sumar(float operando1, float operando2); // funcion de la suma entre dos operandos
float restar(float operando1, float operando2); // funcion de la resta entre dos operandos
float multiplicar(float operando1, float operando2); // funcion de la multip... |
C | #include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<unistd.h>
#include<stdio.h>
#include<string.h>
int main(void){
FILE* fp=fopen("./ftest.txt","w");
char buf[80];
int ret=0;
memset(buf,0,sizeof(buf)); //qingkong
printf("input data into file\n");
fgets(buf,sizeof(buf),stdin);
// PR... |
C | #include<stdio.h>
int main(int argc, char *argv[]) {
puts("Hello World");
printf("%d\n",argc);
int i = 0;
for(i =0 ; i< argc; i++) {
printf("%s\n",argv[i]);
}
return 0;
}
|
C | #include<stdio.h>
void main()
{
int a,add,sub,mul,mod,div,x,y;
printf("Enter two numbers x & y :\n");
scanf("%d%d",&x,&y);
printf("1=Addition\n");
printf("2=Subtraction\n");
printf("3=Multiplication\n");
printf("4=Division\n");
printf("5=Modulus\n");
printf("Enter your choice\n:");
... |
C |
/* demo pipe
with 2 args
like pipe who sort = who | sort
who's output to sort's input.
*/
#include<stdio.h>
#include<unistd.h>
#define oops(m,x) {perror(m); exit(x);}
main(int argc, int *argv[])
{
int pipefd[2];
int pid;
if(argc != 3)
oops("usage: pipe cmd1 cmd2\n" ,1 )... |
C | #include <stdio.h>
int main(){
char c;
printf("Entrez un caractére : \n");
scanf("%c", &c);
if(c >= 'a' && c <= 'z'){
switch (c) {
case 'a': case 'e': case 'i': case 'o': case 'u': case 'y': printf("C'est une voyelle !");
break;
default: printf("C'est une ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lst_associative_set.c :+: :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* write01.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<locale.h>
int main(){
setlocale(LC_ALL,"Portuguese");
int entrada, i,flag = 0;
printf("\nPor favor digite um nmero:\n");
scanf("%d",&entrada);
for(i = 2; i < entrada ; i++ ){
if(entrada%i == 0){
printf("O nmero no primo!%d");
break;
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* draw_texture_utils.c :+: :+: :+: ... |
C | #ifndef LIBABACUS_TABLE_H
#define LIBABACUS_TABLE_H
#include "basetype.h"
#include "custom.h"
#include "refcount.h"
#include "result.h"
#include "trie.h"
/**
* A struct that represents a structure
* similar to a symbol table. This structure
* is used to keep track of definitions such
* as types, functions, and va... |
C | /*
Linked Lists are linear data structure. A singly linked list is formed
by connecting nodes from one to other in a linear fashion i.e. one node is
connected to second and it is connected to other and so on.
Each node of a linked list contains two elements
1. Data - the data is stored in this part
2. Next (o... |
C | #include<stdio.h>
int main()
{
char str[50];
int i;
int cnt;
printf("\nenter your name :");
scanf("%[^\n]s", str);
for(i=0, cnt=0;str[i]!='\0';i++)
if(str[i] == ' ' && str[i+1]!= ' ')
cnt++;
printf("\nnumber of words : %d" ,cnt+1);
return 0;
}
|
C | //Check if was imported yet
#ifndef COORDINATE_H
//Define as imported
#define COORDINATE_H
//Coordinate data type
typedef struct coordinate {
short x_coord, y_coord;
int cost;
};
//Coordinate Queue data type(queue of coordinates)
typedef struct coordinate_queue {
//Address in memory of coordinate
struc... |
C | #include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#define NR_END 1
#define FREE_ARG char*
#define NRANSI
#define SWAP(a, b) itemp=(a);(a)=(b);(b)=itemp;
#define M 7
#define NSTACK 50
void nrerror(char error_text[])
/* Numerical Recipes standard error handler */
{
fprintf(stderr,"Numerical Recipes run-time... |
C | /********************************
* Fichier affiche_suite_entiers.c
* Livre "Exercices corrigés de développement système sous Linux"
*
* (c) 2018 P. Alain, J. Chevelu, V. Thion
*
********************************/
#include <stdio.h> // fprintf
#include <unistd.h> // sleep
#include <stdlib.h> // exit
int main(v... |
C | /*
* Or Paz
* 311250708
*/
#include <stdio.h>
#include <memory.h>
typedef void (*functionPtr)(char*,char*);
typedef enum specialChar {
eNone = 0x0,
eWin = 0x000d000a,
eMac = 0x000d,
eLinux = 0x000a
} specialChar;
/**
* this func copy file from source to destantion.
* @param src - source file.
... |
C | #include "user_database.h"
Node **database_link_list;
void load_data_base(){
database_link_list=create_link_list();
FILE *fin=(FILE *)fopen("account.txt","r");
if(fin==NULL){
printf("Don't exist file contain database\n");
exit(1);
return ;
}
char name[MAXLENNAME],password[MAXLENPASSWORD];
int st... |
C | //Jay Shah
//1-9-20
//Lab 1 Part 2
//implements quantitative comparisons between circuit switching and packet switching
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double fact(int);
int main(int argc, char *argv[]){
double linkBandwidth =atoi(argv[1]);
double userBandwidth = atoi(argv[2]);
do... |
C | /* Max Schweitzer
ECE 373
Homework 3 - PCI LED Driver
This code implements a user space program to
test a basic PCI driver that can blink an LED.
4/22/18
*/
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#de... |
C | /*******************************************************
uOLED-160-GMD1 Driver for Arduino
Code: Oscar Gonzalez
August 2007
www.bricogeek.com
*******************************************************/
#define OLED_BAUDRATE 9600//57600
#define OLED_RESETP... |
C | //12864ʱʵ
///**************************************/
#include<reg51.h>
#include<intrins.h>
#include "QC12864B.h"
/**************************************/
#define uchar unsigned char
#define uint unsigned int
//˿ڶ
sbit LCD_CS=P2^6;
sbit LCD_SID=P2^5; //
sbit LCD_SCLK=P2^7; //ʱ
sbit LCD_R... |
C | #include<stdio.h>
#include<stdint.h>
#include<inttypes.h>
int main()
{
int i;
int32_t i32; //32 bit integer
int_least8_t i8; //smallest 8 bit
int_fast8_t imax; //fastest minimum
uintmax_t uimax; //biggest signed integers
i32 = 1004; //biggest unsigned inter
printf("m... |
C | #include <stdio.h>
int main()
{
int array[101], b[101], n, l=0;
printf("Input n: ");
scanf("%d", &n);
for (int i=0; i<=n; i++)
{
printf("Input array[%d]: ",i);
scanf("%d",&array[i]);
}
for (int i=0; i<=n; i++)
{
if (array[i]%2 == 0)
{
l++;
... |
C | #include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/select.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <poll.h>
#include <errno.h>
#define N 128
int main(int argc,const char* argv[])
{
int sockfd;
int acce... |
C | /* Author: Pierre-Jerome Bergeron
This is the Vardi EM algorithm from Biometrika (1989).
Provided as is. If you publish something using this code, please make sure to mention me....
*/
//This little function counts the number of time each unique entry appears
//in a sorted vector
void countsorted (double *x, int *n... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "Persona.h"
#include "Pregunta.h"
Persona* personas;
Pregunta* preguntas;
void histogramaFrecuencia();
void histogramaEdad();
int main()
{
int NUM_PERS = 10;
int NUM_PREG = 10;
int NUM_RESP = 6;
int i,j,k;
personas = (Persona*)ma... |
C | #include <gtk/gtk.h>
/* Surface to store current scribbles */
static cairo_surface_t *surface = NULL;
static void
clear_surface(void)
{
cairo_t *cr;
cr = cairo_create(surface);
cairo_set_source_rgb(cr, 1, 1, 1);
cairo_paint(cr);
cairo_destroy(cr);
}
/* Create a new surface of the appropriate s... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lista.h"
#include "formaC.h"
#include "formaL.h"
#include "formaR.h"
#include "formaT.h"
#include "hidrante.h"
#include "quadra.h"
#include "radio.h"
#include "semaforo.h"
typedef struct no{
void *elemento;
struct no *ant;
struct no *prox... |
C | /* ziplist是经过特殊编码的双向链接列表,旨在提高内存效率。 它存储字符串和整数值,其中整数被编码为实际整数,而不是一系列字符。
* 它允许在O(1)时间在列表的任一侧进行推和弹出操作。 但是,由于每个操作都需要重新分配zip列表使用的内存,因此实际的复杂性与
* zip列表使用的内存量有关。
*
* ----------------------------------------------------------------------------
*
* ZIPLIST总体布局
* ======================
*
* ziplist的总体布局如下:
*
* 头... |
C | // exmaple of duplication C assigned twice
#include <stdio.h>
void increment(int C)
{
int C = 1;
int A = 12;
A = A + C;
printf("%d",C);
}
void main()
{
int C = 2;
C = 4;
increment(C);
printf("%d", C);
}
|
C | #include "bazadanych.h"
void zerujBufor()
{
int i = 0;
for(i = 0; i < MAXBUFOR; i++)
bufor[i] = 0;
}
void zapelnijBufor(FILE *plik)
{
zerujBufor();
fgets(bufor, 1024, plik);
bufor[strlen(bufor) - 1] = 0; // usuniecie znaku '\n' z konca bufora
if(bufor[strlen(bufor) - 1] == 13) // usuniecie z bu... |
C | #include <stdio.h>
int main(){
int n,i,y=0,k=0,s=0,flag=1;
scanf("%d",&n);
int x[n];
scanf("%d",&x[0]);
scanf("%d",&x[1]);
if(x[0]==x[1]){
flag=0;
}
for(i=2;i<n;i++){
scanf("%d",&x[i]);
while(s!=EOF){
if(x[0]<=x[1])
k=0;
else
k=1;
s--;
}
if(i%2==k... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdbool.h>
#include "student.h"
void parse_file(char file[], char db[])
{
char line_buf[255];
FILE* fptr;
fptr = fopen(file, "r");
while(!feof(fptr))
{
fscanf(f... |
C | #include <stdio.h>
#include <locale.h>
//Faça um programa para calcular a área de um retângulo.
int main()
{
setlocale(LC_ALL, "Portuguese");
double h, b, area;
printf("Informe o comprimento dos lados do retângulo (altura, base): ");
scanf("%lf %lf", &h, &b);
area = h * b;
printf("Área = %.2lf, Altura = ... |
C | #include <stdio.h>
void arrange(int scores[], int size){
//配列変数resultを用意
const int Nsize = size;
int result[Nsize];
printf("scores = ");//引数のscores配列の出力
for(int i=0; i<size; i++){
printf("%d ",scores[i]);
result[i] = scores[i];
for(int a = i; a>0; a--){
//若い数字の配列と比較し並び替える
if(result[a]... |
C | //ָ:
//ҵмڵ㣬Ҫֻܱһ
SListNode* SListFindMidNode(SListNode* list)
{
if (list == NULL || list->_next == NULL)
{
return list;
}
else
{
SListNode* slow = list;
SListNode* fast = list->_next->_next;
while (fast)
{
slow = slow->_next;
fast = fast->_next;
if (fast)
{
fast = fast->_next;
}
}
... |
C | //steve Tan z5237560
//Date Oct. 2019
#include <stdio.h>
int main(void) {
double totalNumber, marksAwarded;
double percentage;
//define the variable.
printf("Enter the total number of marks in the exam: ");
scanf("%lf", &totalNumber);
printf("Enter the number of marks the student was awarded: ")... |
C | //
// main.c
// 2-Player Math Game
//
// Created by Jacob Cho on 2014-10-07.
// Copyright (c) 2014 Jacob Cho. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
struct Player {
char *name;
int lives;
int score;
};
enum {
addition,
subtraction,
multipl... |
C | #include "AdjMatrix.h"
/* ضλ */
int PositionVex(AMGraph g,char ch)
{
int i;
for(i=0;i<g.vexnum;i++)
if(g.vexs[i]==ch)
return i;
return -1;
}
/* ͼ(ڽӾ) */
AMGraph* CreateAdjMatrix()
{
int vlen;
int elen;
int i,p1,p2;
char *vexs;
char (*edges)[2];
AMGraph *pG;
... |
C | #include "lists.h"
/**
* add_nodeint_end - Adds a new node to the end of @head
*
* @head: Singly linked list
* @n: Value for new node to be added to end of @head
*
* Return: (Success) Address of newly created node
* (Failure) NULL
*/
lis... |
C | /*
* Title : Time Duration Counter and Converter to Second (MenghitungDurasiWaktudanKonversiKeDetik.c)
* Program Description : To Calculate Time Duration and Convert It to Second Written in C Language Code.
* Author : Muhammad Hasbi, S.T.
* Interface : Console
* IDE ... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<pthread.h>
#include<unistd.h>
#include<time.h>
int* thread(char s[])
{
int pos = 0;
while(1)
{
printf("\033[s");
//设置光标位置
printf("\033[%d;%dH", 5, 5);
//清除从光标到行尾的内容
printf("\033[K");
printf("%... |
C |
#include<stdio.h>
#include<stdlib.h>
int* arrayFill(int *arr, int n) // Filling first array with elements.
{
for(int i = 0; i<n; i++)
{
printf("Enter element №%d\n", i+1);
scanf("%i", &arr[i]);
}
return arr;
}
void arrayCopy(int *arr, int *arr2, int n) // Copying elements from firs... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <ctype.h>
#include <sys/ipc.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <pthread.h>
#include <time.h>
extern pthread_mutex_t thread_m... |
C | void fair_surf(bspl,lu,lv,knot_u, knot_v)
/* Fairs B-spline control net.
Input: bspl: B-spline control net (one coordinate only)
lu,lv: no. of intervals in u- and v-direction
knots_u, knots_v: knot vectors in u- and v-direction
Output: as input
*/
float bspl[20][20],knot_u[],knot_v[];
int lu,lv;
{... |
C | #include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/shm.h>
#include<sys/sem.h>
#include<sys/stat.h>
void main(int n, char **argv)
{
int semid = semget(atoi(argv[1]), 1, IPC_CREAT|IPC_EXCL|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH);
if(semid == -1)
{... |
C |
#include <stdlib.h>
#include <stdio.h>
#include "semaphore.h"
void sem_init(sem_s* sem, unsigned int val) {
sem->compteur = val;
sem->ctx_curr = NULL;
}
void sem_down(sem_s* sem) {
irq_disable();
sem->compteur--;
// printf("sem_down()->compteur = %i\n", sem->compteur);
if (sem->compteur < 0) {
cctx->sem_ne... |
C | /*
* Jake Halloran
* Yahtzee implementation for CS 0449 Project 4
* Last Edited: 4/9/16
**/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#define NUM_DICE 5
#define NUM_TURNS 13
int upper_data[6];
int lower_data[7];
int has_bonus;
int roll[5];
int needs_rolled[5];
int score_pos_used[13]... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
#include<arpa/inet.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<fcntl.h>
#include<netinet/in.h>
#include<netdb.h>
void error_handling(char *message);
int main(int argc, char **argv)
{
int sock;
struct sockaddr_in serv_a... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int *random_array(int n);
int main(void)
{
srand(time(NULL));
int *array = random_array(100);
for (int i = 0; i < 100; i++) {
printf("array[%d] = %d\n", i, array[i]);
}
free(array);
return 0;
}
int *random_array(int n)
{... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.