language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
int main()
{
int a,b,sub;
printf("Please input two values for subtract:");
scanf("%d %d",&a,&b);
sub=a-b;
printf("%d - %d = %d\n",a,b,sub);
return 0;
}
|
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | #include <stdio.h>
/**
*main - print 00 - 99 with comma
*
*Return: 0
*/
int main(void)
{
int i;
int j;
i = 48;
while (i < 58)
{
j = 48;
while (j < 58)
{
putchar(i);
putchar(j);
if (i == 57 && j == 57)
break;
j++;
putchar(',');
putchar(' ');
}
i++;
}
putchar('\n');
return... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* creat_display.c :+: :+: :+: ... |
C | /*
============================================================================
Name : problem1.c
Author :
Version :
Copyright : Your copyright notice
Description : Newton Root
============================================================================
*/
#include <stdio.h>
#include <stdlib.... |
C | #include <stdio.h>
#include "common/types.h"
#include "common/debug.h"
#include "packet.h"
void debug_print_packet(struct packet * pkt)
{
int i;
unsigned char * skb = packet_data(pkt);
for(i = 0; i < 64; i++)
{
printf("%d ",skb[i]);
}
printf("********\n");
for(i = 0; i < 64; i++)
{
printf("%x ",skb[i])... |
C | //circular queue
typedef struct{
char name[5];
int CBT;
}Job;
typedef struct{
Job *job;
int front, rear, capacity,size;
}Queue;
int isEmpty(Queue q){
if(q.size==0)
return 1;
else
return 0;
}
int isFull(Queue q){
if(q.size == q.capacity)
return 1;
else
return 0;
}
void init(Queue *q){
printf("\... |
C | #include "config.h"
#include "assembler.h"
#include "labels.h"
#include "def_op.h"
#include "check_line.h"
/**********************************************************************************************
This function execute the second pass on the given file and search for syntax error. Moreover,
this function ext... |
C | #include <stdio.h>
#include <string.h>
int main() {
int i, j = 0;
char w[1000];
gets (w);
for(i = strlen(w) - 1; i >= (int)strlen(w)/2 ; i--) {
char x = w[i];
w[i] = w[j];
w[j] = x;
j++;
}
printf("%s", w);
return 0;
}
|
C | //----------------------------------------------------------------
// Statically-allocated memory manager
//
// by Eli Bendersky (eliben@gmail.com)
//
// This code is in the public domain.
//----------------------------------------------------------------
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#incl... |
C | #include <stdio.h>
#include <stdlib.h>
int a(int*n,int x)
{
int i;
for(i=1;(i*2)<=x;i++)
{
(*n)++;
a(n,i);
}
return 0;
}
int main()
{
int x,n=1;
scanf("%d",&x);
a(&n,x);
printf("%d",n);
return 0;
}
|
C | #include "factory.h"
int insert_login(user p)
{
//插入信息
MYSQL *conn;
//从配置文件中读取连接信息
FILE *config;
config=fopen("../conf/mysql.conf","r");
char server[50]={0};
char user[50]={0};
char password[50]={0};
char database[50]={0};//要访问的数据库名称
fscanf(config,"%s %s %s %s",server,user,password,database);
char query[300]... |
C | #include <stdio.h>
int main ()
{
int Bills_of_20 ,Bills_of_10 ,Bills_of_5 ,Bills_of_1 ,amount;
printf ("Enter the amount of money = ");
scanf("%d" ,&amount);
Bills_of_20 = amount / 20;
amount %= 20;
Bills_of_10 = amount / 10;
amount %= 10;
Bills_of_5 = amount / 5;
amount %... |
C | #include <pthread.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <png.h>
#include <stdint.h>
#include <errno.h>
#include <sys/stat.h>
/*
These Values are used to control the recursive fractal funtion.
DEPTH: The maximum number of steps used for testing
ESCAPE: The... |
C | #include <linux/module.h>
#include <linux/kernel.h>
#include <linux/proc_fs.h>
#include <linux/uaccess.h>
#include <linux/slab.h>
// #define MAX_BUF_SIZE 16
static int MAX_BUF_SIZE = 16;
char *msg_init;
// static char proc_buf[MAX_BUF_SIZE];
static char* proc_buf = NULL;
static unsigned long proc_buf_size = 0;
static ... |
C | #include <stdio.h>
extern int work();
void main()
{
int i;
i = work();
printf("i is %d\n",i);
}
|
C | #include<stdio.h>
main()
{
char *name="name";
change(name);
printf("%s",name);
}
change(char **name)
{
char *nm="newname";
name=nm;
} |
C | #include "queue.h"
static node *create_node(int id, int time, node *link) //c
{
struct node* temp = (struct node*)malloc(sizeof(struct node));
temp->id = id;
temp->time = time;
temp->link = NULL;
return temp;
}
void list_initialize(List *ptr_list) //c
{
ptr_list = (List*) malloc(sizeof(Li... |
C | /*
* Problem 17 - Reverse()
*
* Write an iterative Reverse() function that reverses a list by rearranging
* all the .next pointers and the head pointer. Ideally, Reverse() should only
* need to make one pass of the list. The iterative solution is moderately
* complex. It's not so difficult that it needs to be thi... |
C | #include "fifo.h"
#include "stddef.h"
#include "stdint-gcc.h"
#include "stdlib.h"
#include <stdint.h>
#include <stdbool.h>
/**
* \brief This function initializes fifo. It should be done only once for one fifo. The initialization process depends on assigning the buffer to the fifo, and setting its size
* \param[in] ... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
char *names[] = {"Miller","Jones","Anderson"};
printf("%c\n",*(*(names+1)+2));
printf("%c\n",names[1][2]);
return 0;
}
|
C | #include "2-us_xfr.h"
#include <errno.h>
int main(int argc,char *argv[]){
int sfd,cfd;
ssize_t numRead;
struct sockaddr_un uaddr;
char buf[BUF_SIZE];
sfd = socket(AF_UNIX,SOCK_STREAM,0);
if(sfd == -1){
fprintf(stderr,"socket\n");
exit(EXIT_FAILURE);
}
if(remove(SV_SOCK_PATH) == -1 && errno != ENOENT){
... |
C | #include <stdlib.h>
#include <stdio.h>
#include <zlib.h>
#define BUF 0x200
int main(int argc, char** argv)
{
unsigned char buf[BUF];
unsigned long adler = adler32(0, Z_NULL, 0);
size_t len;
while((len = fread(buf, sizeof(unsigned char), BUF, stdin)) != 0)
adler = adler32(adler, buf, len);
printf("0x%08lx\n"... |
C | #include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include "hwlib.h"
#include "socal/socal.h"
#include "socal/hps.h"
#include "socal/alt_gpio.h"
#include "hps_0.h"
#include "perifericos.h"
#define HW_REGS_BASE ( ALT_STM_OFST )
#define HW_REGS_SPAN ( 0x04000000 )
#define HW_REGS_MASK ( HW_... |
C | #include <stdio.h>
#include <stdlib.h>
#include "tetris.h"
#include <Windows.h>
enum ConsoleColor {
Black = 0,
Blue = 1,
Green = 2,
Cyan = 3,
Red = 4,
Magenta = 5,
Brown = 6,
LightGray = 7,
DarkGray = 8,
LightBlue = 9,
LightGreen = 10,
LightCyan = 11,
LightRed = 12,
LightMagenta = 13,
Yellow = 14,
White = 15
};
int
m... |
C | /* A simple SSL client.
It connects and then forwards data from/to the terminal
to/from the server
*/
#include "common.h"
#include "client.h"
#include "read_write.h"
static char *host=HOST;
static int port=PORT;
static int require_server_auth=1;
static char *ciphers=0;
static int s_server_session_id_context = ... |
C | /*
* Copyright 2014 Chen Ruichao <linuxer.sheep.0x@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required b... |
C | #include <stdio.h>
#include <unistd.h>
#define claimedMemory syscall(354)
#define freeMemory syscall(353)
int main() {
float fragmentation;
printf("Running 3 tests:\n");
int i;
for (i = 0; i < 3; i++) {
fragmentation = (float)freeMemory / (float)claimedMemory;
printf("Claimed Memory: \t%lu\... |
C | void putnonintrablk(short *blk)
{
int n, run, signed_level, first;
run = 0;
first = 1;
for (n = 0;n<1<<6;n++) {
/* use appropriate entropy scanning pattern */
signed_level = blk[(altscan?alternate_scan:zig_zag_scan)[n]];
if (signed_level!=0) {
if (first) {
/* first coefficient in non-intra... |
C | /*************************
SELECT
C File
Author : Yonatan Zaken
Date : 05/04/2020
*************************/
#define _POSIX_C_SOURCE 200112L
#include <stdio.h> /* stderr */
#include <stdlib.h>
#include <string.h> /* memset */
#include <unistd.h> /* close ... |
C | #include "adc.h"
#include <util/delay.h>
uint8_t _adc_mode;
RingBuffer* _adc_buffer;
// Sets the sampling schedule for the different ADC channels.
uint8_t* _adc_mux_schedule;
uint8_t _adc_schedule_mask;
volatile uint8_t _adc_busy;
/*uint8_t _findbit(uint8_t needle, uint8_t haystack){
++needle;
uint8_t pos = 0;... |
C | #include<stdio.h>
#include<stdlib.h>
int totaltime=0;
void choose(int **box,int n)
{
int i,j =0,a;
int temp;
for (i = 0; i < n - 1; i++)
{
for (j = 0; j < n - 1; j++)
{
if (box[j][1] > box[j + 1][1])
{
temp = box[j][1];
box[j][1] = box[j+1][1];
box[j + 1][1] = temp;
tem... |
C | // Copyright (2018) Baidu Inc. All rights reserved.
/**
* File: lightduer_flash.h
* Auth: Sijun Li(lisijun@baidu.com)
* Desc: Common defines for flash strings module.
*/
#ifndef BAIDU_DUER_LIGHTDUER_FLASH_H
#define BAIDU_DUER_LIGHTDUER_FLASH_H
#ifdef __cplusplus
extern "C" {
#endif
#include "lightduer_types.h"
#... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
// initializing functions
float get_num();
char get_op();
float m_exp(float sub_exp, char op);
float s_exp(float sub_exp, char op);
int main() {
char choice;
printf("Please enter a simple arithmetic expression: ");
float ans = s_exp(0, '+');
printf("%.2f... |
C | #include "header.h"
//GLOBAL VARIABLES
//They are global because the might be needed in multiple
//functions and the signal handler in case of signal
//from child processes or SIGINT etc
DIR* working_dir = NULL;
char* file = NULL;
char* dir_name = NULL;
//bloom filter info
int bloom_size = 0;
char* bloom_string = NU... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | /*______________mystring_ars.c_____________
* assignement 1
* hy255
* Tsolis Dimitris
* email:tsolis@csd.uoc.gr
*
* Contains a function implementation of the interface introduced by
* mystring.h library.
* This implementation is done with use of arrays
*
*/
#include<assert.h>
#include<stddef.h>
/*******HEL... |
C | /*************************************************************************
> FileName: ipc-shm.c
> Author : DingJing
> Mail : dingjing@live.cn
> Created Time: 2021年03月16日 星期二 15时59分36秒
************************************************************************/
#include<stdio.h>
#include<stdlib.h>
#include <sys/ipc.... |
C | #include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "xyutils.h"
#define TAG "[xyutils] "
#define STRING_LEN 256
int check_ptr_invalid(void *ptr) {
xylogd();
if (NULL == ptr) {
return -1;
} else {
return 0;
}
}
int ... |
C | // $Date: 2018-05-22 06:24:02 +1000 (Tue, 22 May 2018) $
// $Revision: 1330 $
// $Author: Peter $
#include "Ass-03.h"
//
// This task can be used as the main pulse rate application as it takes
// input from the front panel.
//
// *** MAKE UPDATES TO THE CODE AS REQUIRED ***
//
// Draw the boxes that make up the... |
C |
#include <stdio.h>
#include <Windows.h>
#include <string.h>
#include <locale.h>
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lparam) {
wchar_t** programs = (wchar_t**) lparam;
static int index = 0;
// 여러번 실행 시, static 변수의 값 유지에 의한 오류 방지
if(getArrayLength(programs) == 0) {
index = 0;
}
... |
C | #include <stdio.h>
#include <stdlib.h>
#include "matriz.h"
struct matriz{
int nlinhas;
int ncolunas;
int** mat;
};
Matriz* inicializaMatriz(int nlinhas, int ncolunas){
Matriz* matrix;
int i, j;
matrix = (Matriz*)malloc(sizeof(Matriz));
matrix->nlinhas = nlinhas;
matrix->ncolunas ... |
C | #include "common.h"
int replace (int ind)
{
int i, j;
int distances[framesz];
//find distances of each frame and chose maximum distance to replace
for (i=0; i<framesz; i++)
{
for (j=ind+1; j<n; j++)
if (refstr[j]==pages[i])
{
break;
}
distances[i]=j-ind;
}
int maxm=distances[0];
int repl=0;
... |
C | // File: emi_files.c - emi program file functions
#include <stdio.h>
#include "emi.h"
/* f_underline: underline string of characters */
void f_underline(const char *filename, char line, const int strlen) {
FILE *file;
file = fopen(filename, "a+");
for (int i = 0; i < strlen; i++) fprintf(file, "%c", line)... |
C | #include <stdlib.h>
#include <stdio.h>
#include "definicions.h"
void num_malformado(int tipo_num, char* lexema, int linha){
switch(tipo_num){
case INT_MAL:
printf("------------------------------------------------------------------------------------------------------------\n-->O enteiro %s da liña %d está ... |
C | // ----------------------------------------------------------------------------------------
// Implementation of Example target.3c (Section 52.3, page 196) from Openmp 4.0.2 Examples
// on the document http://openmp.org/mp-documents/openmp-examples-4.0.2.pdf
//
//
//
//
// --------------------------------------------... |
C | /*
Write a program which returns addition of all element from singly linear
linked list.
Function Prototype :int Addition( PNODE Head);
Input linked list : |10|->|20|->|30|->|40|
Output : 100
*/
#include "Header.h"
int main()
{
PNODE First = NULL;
int iRet = 0;
InsertFirst(&First, 40);
InsertFirst(&F... |
C | #include "socketCrawler.h"
#define TRUE 1
#define FALSE 0
#define LENBUFFER 512
#define LEN_VETOR 1024
//definir a estrutura do socket servidor
struct addrinfo criarServidor(struct addrinfo hints, struct addrinfo **res, char *endereco){
memset(&hints, 0, sizeof hints);
hints.ai_family = AF_INET;
hints.ai_... |
C | // Graph接口
#pragma once
#include "config.h"
#include "window.h"
#include "point.h"
#include "common.h"
static int __static_graph_id = 0; //全局变量:待分配的Graph ID序号
struct graph_description {
//图形通用描述信息
int id; // 图元ID序号
char name[__GRAPH_DESCRIPTION_NAME_MAX__]; //图元名称
struct point center; ... |
C | /*
* <Melarpise5.c Adelson-Velskii and Landis Tree Implementation>
* Copyright (C) <2014> <Ferriel Lisandro B. Melarpis>
* NOTE:
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; eithe... |
C | // T.U.Senasinghe - IT21073878 - 2021 Batch - group 05.1.A
#include<stdio.h>
int main(void)
{
//ariables
char trancTyp;
double bal;
double amt;
double newbal;
printf("Enter Transaction type (W - withdrawls , D - Deposit) : ");
trancTyp = getchar(); //Transcaction type
if (trancTyp == 'W' || t... |
C | /*
ü Ʈ ĭ (ε ) 밢 ĭ ̵ ϹǷ 8 Ѱ ̵ մϴ.
Ʈ ġ ־ ̵ ϼ.
*/
#include <stdio.h>
#include <stdlib.h>
void SetINFO(char*);
int solution(char pos[]) {
char pos_x = pos[0];
char pos_y = pos[1];
int i, count = 0;
// Ʈ ̵ϴ ǥ
int arr[][2] = {{-2, 1}, {-1, 2}, {1, 2}, {2, 1}, {2, -1}, {1, -2}, {-1, -2}, {-2, -1}};
// ó
... |
C | #include <stdio.h>
int main() {
int * p;
int arr[] = { 2, 7, 9, 3};
printf("Address of array and address of pointer are two totally different things\n");
printf("Address of array is the address of its first component\n");
printf("Address of pointer is the address of the memory location where... |
C | /******************************************************
* FILE NAME : data_traffic_proc.c
* VERSION : 1.0
* DESCRIPTION : output the recorded host information
*
* AUTHOR : tangyupeng
* CREATE DATE : 08/10/2016
* HISTORY :
******************************************************/
#include <linux/seq_file.h>
#include ... |
C | /******************************************************************************
Realizar un programa que determine si una persona es mayor o menor de edad.
Datos de entrada
Entero: edad
Proceso
Escribir "Ingrese su edad"
Leer edad
Si(edad>=17)
Escribir "Mayor de edad"
Sino
Escribir "Menor de edad"
Salida
Ma... |
C |
#include "../../reowolf.h"
#include "../utility.c"
int main(int argc, char** argv) {
// Create a connector, configured with our (trivial) protocol.
Arc_ProtocolDescription * pd = protocol_description_parse("", 0);
char logpath[] = "./pres_3_bob.txt";
Connector * c = connector_new_logging(pd, logpath, sizeof(logp... |
C | char buffer_client[1024];
int clientSocket;
struct sockaddr_in serverAddr;
pthread_t thread1, thread2;
int iret1, iret2;
socklen_t addr_size;
int port;
/* Status Bar*/
void status_bar(int i,int total){
int j;
int percent = (25*i)/total;
printf("[");
for(j=0;j<=percent;j++){
printf(">");
}
for(j=0;j<25-percent... |
C | #include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include <ctype.h>
int main(int argc, char *argv[])
{
int sock_conn, sock_listen, ret;
struct sockaddr_in serv_adr;
char buff[512];
char buff2[512];
// INICIALITZAC... |
C | /*
Tim M. Lael
CS4280
p3
14-APR 2017
*/
/*
semantics.h
This is the source file containing function the definition for
stack and semantic operations
*/
/* Begin inclusion-prevention mechanism */
#ifndef SEMANTICS_H
#define SEMANTICS_H
#define MAXSTACKSIZE 100 /* Stack size limit per project spec */
#in... |
C | #include "red_black_tree.h"
#include <stdlib.h>
#include <stdio.h>
#include "common.h"
#define NIL (&p_tree->nil)
#define ROOT (p_tree->p_root)
#define _set_nil(p_node) (p_node = NIL)
#define _is_red(p_node) (p_node->color == red)
#define _set_left_child(parent,child) \
do { \
parent->p_l... |
C | //bai tap 3
#include <stdio.h>
#include <math.h>
int main()
{
float a, b;
printf("Nhap do dai canh thu nhat cua hcn : ");
scanf("%f", &a);
printf("Nhap do dai canh thu hai cua hcn : ");
scanf("%f", &b);
printf("\nChu vi cua hcn la : %f\n", (a+b)*2);
printf("\nDien tich cua hcn la : %f\n",... |
C | // SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2000-2001 Silicon Graphics, Inc.
* All Rights Reserved.
*/
#include <lib/hsm.h>
#include <getopt.h>
#include <string.h>
/*---------------------------------------------------------------------------
Test program used to test the DMAPI function dm_remove_dmat... |
C | #include "Atoms.h"
const int cornerLimit = 2;
const int sideLimit = 3;
const int otherLimit = 4;
struct dim dimensions;
struct dim *enter_dim(int x, int y){
dimensions.xDim = x;
dimensions.yDim = y;
return &dimensions;
}
struct root *createList(){
struct root *list = malloc(sizeof(struct root));
... |
C | #include"Header.h"
int main()
{
int iCnt=0,iLength=0,iRes=0;
int *ptr=NULL;
printf("Enter No of Elements");
scanf("%d",&iLength);
ptr=(int*)malloc(iLength*sizeof(int));
printf("Enter Data");
for(iCnt=0;iCnt<iLength;iCnt++)
{
scanf("%d",&ptr[iCnt]);
}
iRes=Prime(ptr,iLength);
printf("Largest Prime i... |
C | #include<stdio.h>
int main()
{
int a,b;
printf("Enter The First Number :");
scanf("%d",&a);
printf("Enter The Second Number :");
scanf("%d",&b);
a=a+b;
b=a-b;
a=a-b;
printf("First Number = %d\nSecond Number = %d",a,b);
return 0;
}
|
C | /*#include "syscall.h"
#define SIZE 100
int
main()
{
int array[SIZE], i, sum=0;
for (i=0; i<SIZE; i++) array[i] = i;
for (i=0; i<SIZE; i++) sum += array[i];
system_PrintString("1Total sum: ");
system_PrintInt(sum);
system_PrintChar('\n');
system_PrintString("Executed instruction count: ");
... |
C | #include<stdio.h>
struct TestCases
{
char p[100];
int k;
int result;
} tests[] =
{
{ "1239876", 3, 1 }, //positive number divisible by 3
{ "11111", 13, 0 }, //positive number not divisible by 3
{ "9999", 5, 1 },
{ "-123321", 5, 1 }, //negative number divisible by 3
{ "-1221", 21, 1 },
{ "-9897... |
C | #include <stdio.h>
int main(void)
{
int num1, num2, num3;
puts("输入3个整数。");
printf("num1 = "); scanf("%d", &num1);
printf("num2 = "); scanf("%d", &num2);
printf("num3 = "); scanf("%d", &num3);
int min;
min = num1;
if(num2 < min) min = num2;
if(num3 < min) min = num3;
... |
C | /*
** EPITECH PROJECT, 2019
** mysh
** File description:
** Contains functions used to test an exec list's validity
*/
#include <stddef.h>
#include "structures/exec_list.h"
#include "structures/token_list.h"
#include "functions/str_display.h"
static int get_pipes_nbr(token_list_t *list)
{
int pipes = 0;
whil... |
C |
#include "libft.h"
static size_t wrdnum(char const *s, char c)
{
size_t i;
size_t n;
i = 0;
if (!*s)
return (0);
n = 1;
while (*(s + i) == c)
i++;
while (*(s + i))
{
if (*(s + i) == c && *(s + i - 1) != c)
n++;
i++;
}
if (*(s + i - 1) == c)
n--;
return (n);
}
static size_t wrdlen(char const ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "msgconf.h"
#include "calcs.h"
#include "inits.h"
#include "loyal.h"
#include "traitor.h"
// initializes the generals' roles
role_t* init_roles(int gen_no,int tra_no)
{
role_t *roles=(role_t*)malloc(gen_no*sizeof(role_t));
for(int i=0;i<gen_no;i++)... |
C | #include <stdio.h>
#include <unistd.h>
#include <semaphore.h>
#include <pthread.h>
#include <stdlib.h>
#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#define NUM_THREADS 2
sem_t sem_read, sem_write, sem_ready, sem_count;
int g, c;
void thread_routine(void *args)
{
int r, v, id =... |
C | //
// Created by 12547 on 2021/9/5.
//
#include "stdio.h"
#include "stddef.h"
#include "malloc.h"
typedef struct LNode {
int data;
struct LNode *link;
}LNode, *LinkList;
/**
* 创建 有头结点的单链表
* @param a
* @param n
* @return
*/
LinkList CreateListWithHead(const int a[], int n) {
LinkList hnode = (LinkList)... |
C | /* Algoritmo narrado.
* 1.- Ingresar un numero deseado para realizar la piramide.
* 2.- El numero ingresado será el límite, posterior a este límite
* la escala comenzará a bajar.
* 3.- Imprimir pirámide.
* 4.- Retornar a 0.
*/
#include <stdio.h>
int main ()
{
int numero, i, p, q;
printf ("Ingrese un numero pa... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define REP_A 1901
/**
* Nom de la fonction : jours_annee
* Entrée:
* int a: Une année comprise entre 1901 et 2099
* Sortie:
* int jours : Le nombre de jours depuis 1901 jusqu'à cette année
*/
int jours_annee(int a)
{
return (a - RE... |
C | #include <stdio.h>
#include <cs50.h>
int main(void) //less comfortable
{
int height; //declare variables for easier reading
int line;
int spaces;
int hashes;
do //prompt user for number between 0 and 23
{
printf("Height: ");
height = get_int();
}
while (height < 0 || he... |
C | #include <sms/intv-dummy-rst.h>
#include <sms/console.h>
#include <sms/uart.h>
#include <stdint.h>
/*Interrupt vectors. we want to catch NMI (Pause button)*/
void nmi(){
/*Reset ROM on button press*/
void (*rv)(void) = (void*)0x0000;
rv();
}
void int1(){
/*Do nothing*/
}
uint8_t buff[... |
C | #include <stdio.h>
void rec(int n) {
printf("rec called with value = %d\n", n);
if (n<=1) {
return;
}
rec(n-2);
rec(n-3);
}
int main() {
printf("========\n");
rec(1); //1
printf("========\n");
rec(2); //2, 0, -1
printf("========\n");
rec(5); //5, 3, 1, 0, 2, 0, -1
printf("\n");
}
|
C | /*
* Font search/cache functions for HTMLCSS library.
*
* https://github.com/michaelrsweet/htmlcss
*
* Copyright © 2019-2021 by Michael R Sweet.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
*/
/*
* Include necessary headers...
*/
#include "font-private.h"
#inc... |
C | /***************************************
* EECS2031 – Lab3 isPanlindrom *
* Author: Tingting, Yang *
* Email: Tingtingwang992@gmail.com *
* EECS_num: ilove992 *
* York Student #: 215120579 *
****************************************/
#include<stdio.h>
#include <string.h>
#define SIZE 30
char str[SIZE];
int isPalindr... |
C | /* @author Praveen Reddy
* @date : 2021-10-06
* @desc Creating a Message Queue
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
int main(){
int msqid;
key_t key;
key=ftok(".",'a'); //Passing current directory and proj_id='a' (Least significant 8 bits mus... |
C | #include "material-data.h"
#include "matrix.h"
#include "drying.h"
#include "visco.h"
#include <stdlib.h>
#include <stdio.h>
#define NTERMS 100
int main(int argc, char *argv[])
{
double L = 1e-3, /* Length [m] */
t,
RH;
drydat cond;
int npts = 51, /* Number of points to subdivide t... |
C | #define USER_NAME_LEN 33
#define INTRO_LEN 1025
struct User{
char name[USER_NAME_LEN];
unsigned int age;
char gender[7];
char introduction[INTRO_LEN];
};
|
C | #ifndef _CONSOLE_H
#define _CONSOLE_H
#include "type.h"
typedef
enum real_color {
rc_black = 0,
rc_blue = 1,
rc_green = 2,
rc_cyan = 3,
rc_red = 4,
rc_magenta = 5,
rc_brown = 6,
rc_light_grey = 7,
rc_dark_grey = 8,
rc_light_blue = 9,
rc_light_green = 10,
rc_light_cyan = 11,
rc_light_re... |
C | //
// Created by fff on 3/5/16.
//
#include "string.h"
#include "stdio.h"
#include "stdlib.h"
#include "base64_util.h"
#define MAX 0xFF
/* global base64 original code table */
static char sta_code_table[64] = {
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',// 0 ~ 9
'A', 'B', 'C', 'D', 'E', 'F', '... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
/*Ler 3 valores inteiros (considere que sero informados 3 valores distintos) e escrever a
soma dos dois maiores;*/
main(){
int maior1=0, maior2=0, i, num[100];
for(i=1; i<=3; i++){
printf("numero: ");
scanf("%d", &num[i]);
i... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include <windows.h>
void judg_prime(int num)
{
int n = 0;
if (num <= 1)
printf("%d\n", num);
for (n = 2; n <= num - 1; n++)
{
if (num%n == 0)
{
printf("%d\n", num);
return;
}
else
{
printf("%d\n", num);
return;
}
}
}
int main()
{
... |
C | #include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <arpa/inet.h>
#include "pcap.h"
#include "services.h"
#include "parse.h"
static int ipv4_parse(pcap_record_t *prec, const char *pktdata, int pktlen);
static int ipv6_parse(pcap_record_t *prec, const char *pktdata... |
C | #include <stdio.h>
void practice() {
int *ptr;
ptr = (int *) malloc( sizeof( int) );
printf("Value of ptr: [%d]\n", ptr);
printf("Address of ptr: [%d]\n", &ptr);
free(ptr); // release the memory
}
int main (int argc, char *argv []) {
practice();
return 0;
}
|
C | //prob 1:love ,life and universe
#include <stdio.h>
int main()
{
int pos=-1,i;
int a[1250];
while(1)
{
scanf("%d",&a[++pos]);
if(a[pos]==42)
break;
}
for(i=0;i<=pos;i++)
printf("%d\n",a[i]);
return 0;
}
|
C | #pragma once
struct Rotator
{
public:
/** Rotation around the right axis (around Y axis), Looking up and down (0=Straight Ahead, +Up, -Down) */
float Pitch;
/** Rotation around the up axis (around Z axis), Running in circles 0=East, +North, -South. */
float Yaw;
/** Rotation around the forward axis... |
C | #include "types.h"
#include "stat.h"
#include "fcntl.h"
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
char *os;
os = s;
while((*s++ = *t++) != 0)
;
return os;
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
p++, q++;
return (uchar)*p - (uchar)*q;
}
uint
s... |
C | #include "context.h"
#include "stdio.h"
#include "stdlib.h"
#include "variable.h"
#include "macros.h"
#include "clause.h"
#include "assignment_level.h"
// Forward declarations -------------------------------------------------------
void mergeSort(size_t *arr, size_t l, size_t r, arraymap_t* variables);
static int c... |
C | /**
* \file
* i2c driver
* \author
* Nguyen Van Hai <hainv@ivx.vn>
*/
#include "i2c.h"
/* --EV5 */
#define I2C_EVENT_MASTER_MODE_SELECT ((uint32_t)0x00030001) /* BUSY, MSL and SB flag */
/* --EV6 */
#define I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED ((uint32_t)0x00070082... |
C | #include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdbool.h>
#include <time.h>
//Project 1
#define SEATNUM 250
#define TEL 8
#define SEATLOW 1
#define SEATHIGH 5
#define T_LOW 5
#define T_HIGH 10
#define CARDSUCCESS 90
#define SEATCOST 20
#define BILLION 1000000000L;
//Project... |
C | /*Given a pointer to the root of a binary tree, you need to print the level order traversal of this tree.
In level-order traversal, nodes are visited level by level from left to right.*/
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
struct node {
int data;
str... |
C | /* strlen: return length of string s */
int strlen(char *s)
{
int n;
for (n = 0; *s != '\0'; s++)
n++;
return n;
}
|
C | #include "common.h"
int main(int argc,char *argv[])
{
int sock_listen,sock_control,port,pid;
if(argc!=2)
{
printf("usage:./ftpserv port\n");
exit(0);
}
port=atoi(argv[1]);
if((sock_listen=socket_create(port))<0)
{
perror("error creating socket\n");
exit(... |
C | #define vec_binop(_name, _op) \
int _name ## _slow (sil_State *S, int t1, int t2) { \
int dx=1, dy=1; \
int n = 1; \
const double *x, *y; \
double xval, yval; \
if(t1 == 5 || t1 == 6 || t1 == 7) { \
dx = 0; \
xval = sil_todouble(S, 1); \
x = &xval; \
} else if(t1 == 16) {... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.