language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | //1+3+5......N=N
#include<stdio.h>
int main()
{
int num,i,sum=0;
printf("Enter the last number of series: ");
scanf("%d",&num);
for(i=1;i<=num;i=i+2)
{
sum=sum+i;
}
printf("1+2+3.....+%d = %d",num,sum);
}
|
C | /* Nombre Fichero: include/prog04.h */
#ifndef PROG04_H
#define PROG04_H
// Librerias
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
// Definicion de constantes
#define MAX_NOMBRE 30
#define MAX_ARRAY 55
#define MIN_POBLACION 40000
/* RECUERDE
* NO MODIFIQUE LOS NOMBRES DE LAS FUNCIONES NI EL NOMBRE ... |
C | #include <gtk/gtk.h>
int main(int argc,char *argv[])
{
GtkWidget *window; //一个GtkWidget类型的结构体指针
char title[]="test";
gtk_init(&argc, &argv); //初始化GTK
window = gtk_window_new(GTK_WINDOW_TOPLEVEL); //新建一个window窗体
gtk_window_set_title(GT... |
C | #include<stdio.h>
#include<stdlib.h>
struct people
{
int num;
char name[20];
char sex;
char job;
union stu
{
int class;
char position;
}jo;
}person[10];
int main()
{
int i;
char q;
for ( i = 0; i < 2; i++) {
printf("룺");
scanf("%d", &person[i].num);
printf("");
scanf("%s",&person[i].name);
... |
C | /* { dg-additional-options "-fdiagnostics-show-line-numbers -fdiagnostics-path-format=inline-events -fanalyzer-checker=malloc -fdiagnostics-show-caret" } */
/* { dg-enable-nn-line-numbers "" } */
#include <cstdlib>
struct Base
{
virtual void allocate ();
virtual void deallocate ();
};
struct Derived: public... |
C | #include<stdio.h>
#include<string.h>
#define N 1001
void cha2int(char *tmps, int *tmpi, int len)
{
int i;
for (i = 0; i < len; i++)
{
tmpi[len - i - 1] = (int)(tmps[i] - '0');
}
}
void int2cha(int *tmpi, char *tmps, int len)
{
int i;
for (i = 0; i < len; i++)
tmps[i] = (char)(tmpi[i] + (int)('0'));
}
in... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef enum { false, true } bool;
#define MYSOL false
int main(void) {
char s2[] = "erbottlewat";
char s1[] = "waterbottle";
int size_s2 = sizeof(s2);
int size_s1 = sizeof(s1);
if(size_s2 != size_s1){
printf("s1 isn't a rotation of s2, they are d... |
C | #ifndef BIT_MATRIX_H
#define BIT_MATRIX_H
void set_matrix_bit(uint8_t *byte, uint8_t row, uint8_t col, uint8_t value)
{
setbit(&byte[row], col, value);
}
uint8_t get_matrix_bit(const uint8_t *byte, uint8_t row, uint8_t col)
{
return getbit(&byte[row], col);
}
#endif // BIT_MATRIX_H |
C | /**
* File: breakout.c
*
* Author1: Anton Christensen (anton.christensen9700@gmail.com)
* Date: Winter 2014
*
* Description:
* Breakout game, built for AT-Mega16
* with 20x4 character display.
* requires the aatg library
*/
// 8x5 dots/char
// 4x20 chars/screen
//... |
C | #include "chat.h"
#include <pthread.h>
void* recv_func(void* arg)
{
int fd_server = (int)arg ;
char buf[1024];
while(1)
{
//printf("AA\n");
bzero(buf, 1024);
recvfrom(fd_server,buf,1024, 0 ,NULL, NULL);
printf("recv: %s \n",buf);
}
}
int main (int argc, char const *argv[])
{
if(argc!=3)
{
printf("USAGE... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <semaphore.h>
#include <time.h>
//code by Mateusz Kądziela, 148271
sem_t sem;
int cap_a = 0, cap_b = 0, t_min = 0, t_max = 0; //initializing global variables
float p = 0;
void *visitor(void* i) {
int id = *(int*)i;
i... |
C | #include<stdio.h>
#include<stdlib.h>
#define ZERO 0
#define ONE 1
int length;
int binaryMaker(int len, int arr[], int i);
int main() {
scanf("%d", &length);
int pattern[length];
binaryMaker(length, pattern, 0);
return 0;
}
int binaryMaker(int len, int arr[], int i) {
if(i == len) {
for(int i = 0;... |
C | #include <stdio.h>
int power(int,int);
int main()
{
int base,pow,result;
printf("Enter base number");
scanf("%d",&base);
printf("Enter power number");
scanf("%d",&pow);
result = power(base,pow);
printf("Result is %d",result);
return 0;
}
int power(int base,int pow)
{
i... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h> // clock_t which is the amount of clock cycles since the program began
#include "queue.h"
#include "global.h"
/*
* Initializes a queue and returns it
*/
Queue* initializeQueue()
{
Queue *queue = (Queue*) malloc(sizeof(Queue));
... |
C | #ifndef SHELL_H
#define SHELL_H
//return type: char ** (pointer to a char pointer)
//arguments: char * (a string)
//fxn: parses the pipes in a given line to get arguments
char ** parse_pipe(char *line);
//return type: char ** (pointer to a char pointer)
//arguments: char * (a string)
//fxn: parses the > sign in a giv... |
C | #include <stdio.h>
#include <stdlib.h>
void main(){
int i, j, x;
int M[5][5];
printf("Digite os valores das posicoes.\n");
for(i=0; i<5; i++){
for(j=0; j<5; j++){
printf("[%d][%d]: ", i, j);
scanf("%d", &M[i][j]);
}
}
printf("Valor de Busca: ");
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "estiva/op.h"
#include "estiva/mesh.h"
#include "estiva/ary.h"
#include <unistd.h>
#include <sys/types.h>
static void pltmsh(FILE *fp, xyc *Z, nde *N)
{
long e, a, b, c;
for(e=1;e<=dim1(N);e++){
a = N[e].a, b = N[e].b, c = N[e].c;
fprintf... |
C | #include <cudest.h>
#include <errno.h>
#include <stdio.h>
#include <limits.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/types.h>
// FIXME: we really ought take a bus specification rather than a device number,
// since the latter are unsafe across hardware removal/additions.
static void
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsplit.c :+: :+: :+: ... |
C | /*
* ESE519 LAB2-3.2.c
*
* Created: 2018/9/18 20:03:13
* Author : Wang
*/
#include <avr/io.h>
#define F_CPU 16000000
#define BAUDRATE 9600
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
char buffer [8];
int ... |
C | // tut 4 q3
// Write a program to find a key in a 2D array
#include <stdio.h>
void main() {
int i, j, k, key, flag = 0, beg, end, mid, resrw, rescl;
int a[2][5] = { {11,12,13,14,15}, {16,17,18,19,20} };
printf("Enter the key that is to be searched\n");
scanf("%d", &key);
for (i = 0;i < 2 && flag == 0;i++) {
//... |
C | // Definition for arrays:
// typedef struct arr_##name {
// int size;
// type *arr;
// } arr_##name;
//
// arr_##name alloc_arr_##name(int len) {
// arr_##name a = {len, len > 0 ? malloc(sizeof(type) * len) : NULL};
// return a;
// }
//
//
int partition(arr_integer a,int low, int high){
int left = low;
... |
C | /******************************************************************
* Copyright (C) 2010
* by Pascal Lesage (Keosys)
* Xavier Lecourtier (Keosys) xavier.lecourtier@keosys.com
* ... |
C | /*
5.3-C-10th.6
结构体位宽、位段
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//定义结构体变量的位宽
struct cls_t{
unsigned int a : 8;
/*int b : ;*/
/*char name[10];*/
};
int main(void)
{
struct cls_t a;
a.a = 255 + 1; //unsigned int型溢出后为0
printf("a.a = %d\n", a.a);
printf("sizeof(struct cls_t) = %d\n", s... |
C | /******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
***********************************************... |
C | #include <stdio.h>
#include <stdlib.h>
char *date2string (int ts) {
char *str = malloc (11);
int d,m,y;
y = ts/(30*12);
ts %=(30*12);
m = ts/30;
ts %=30;
d = ts;
sprintf (str, "%02d/%02d/%04d",d,m,y);
return str;
}
int string2date (char *date) {
int d,m,y,ret;
sscanf (date, "%d/%d/%d",&d,&m,&y);
ret = d+m... |
C | /* file: menu_pio.c */
/****************************************************************************
*
* Include Microsoft definitions
*
***************************************************************************/
#include <stdlib.h>
#include <dos.h>
#include <conio.h>
#include <hayes.h>
//#include <gn... |
C | #include "holberton.h"
/**
*print_numbers - prints the numbers, from 0 to 9, followed by a new line.
*@: void
*
*Description: prints the numbers, from 0 to 9, followed by a new line.
*section header: Section description
*Return: void
*/
void print_numbers(void)
{
int num;
for (num = '0'; num <= '9'; num++)
{
_p... |
C | #include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
void error_handling(char* msg)
{
fputs(msg, stderr);
fputc('\n', stderr);
exit(1);
}
int main(int argc, char* argv[])
{
int fd1, fd2;
int n;
char buf[1024];
if(argc != 3)
{
error_handling("argument error");
... |
C | #ifndef TREE_H
#define TREE_H
struct node;
struct tree;
typedef
struct node {
int key;
struct node * parent;
struct node * left;
struct node * right;
} Node;
typedef
struct tree {
Node * root;
} Tree;
void init(Tree *);
void makeTree(Tree *, int);
void printTree(Tree);
void preorderTree(Tree);
void inorder... |
C | #include<stdio.h>
int main()
{
int a[10][10],i,j,r,c=0;
printf("enter the row & column size:");
scanf("%d %d",&r,&c);
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
printf("element a[%d][%d]=",i,j);
scanf("%d",&a[i][j]);
}
}
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
if(a[i][j]!=0){
c=1;
break;
}
else
{
c... |
C | // https://iudex.io/problem/5cb71fc5d41a630001c83e0c/statement
// As recentes vitórias da aliança rebelde rompeu com os anos de dominação inconteste do Império, trazendo ainda mais apoio popular aos rebeldes, o que não pode ser tolerado pelo imperador. O alto comando do Império deseja aplicar uma série de reformas em ... |
C | #include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
int main(){
int a = 27;
int arr[5] = {1,2,3,4,5};
int *p;
p = &a;
//printf("This is my pointer location %p and val %d\n", p, *p);
*p = 5;
printf("Val: %d\n", *p);
p = &arr[3];
printf("Val: %lu\n", sizeof(arr)/sizeof(arr[0]));
... |
C | #include <stdio.h>
#include <stdlib.h>
int main (){
float a,b,c,d;
printf("Digite tres valores: ");
scanf("%f %f %f",&a,&b,&c);
d = (a*a)+(b*b)+(c*c);
printf("a soma dos quadrados dos tres valores e %.2f",d);
return 0;
}
|
C | #include<stdio.h>
int main(int argn, char* argv[]){
int y[] = {23, 57, 83, 29};
printf("y is %p\n", y);
printf("*y is %d\n", *y);
printf("y[0] is %d\n", y[0]);
printf("&(*y) is %p\n", &(*y));
int* x = &y[2];
printf("x[0] is %d\n",x[0]);
printf("x[-1] is %d\n",x[-1]);
printf("x[-3] is %d\... |
C | #include "complete.h"
int main(int argv,char * argc[])
{
int size=atoi(argc[1]);
Ls * ls=(Ls *)malloc(size*sizeof(Ls));
FILE * fptr=fopen(argc[1],"r");
int i=0;
while(fscanf(fptr,"%[^ ] %d\n",ls[i].name,&ls[i].empid)!=EOF)
{
i++;
}
fclose(fptr);
Time T=testRun(ls,size);
// printf(" IS=... |
C | #include "CoreMutex.h"
#include "CoreVerify.h"
#include <pthread.h>
static int DestroyMutex( void *mtx )
{
pthread_mutex_destroy( mtx );
return DALSYS_Free( mtx );
}
static CoreMutexVtable mutex_vtable = {
(CoreMutexMethodType) pthread_mutex_lock,
(CoreMutexMethodType) pthread_mutex_unlock,
DestroyMutex
};
... |
C | #include<stdio.h>
#define MAX 20
int n,adj[MAX][MAX];
int front=-1,rear=-1,queue[MAX];
int main()
{
int i,j=0,k;
int topsort[MAX],indeg[MAX];
create_graph();
printf("Adjacency Matrix is:\n");
display();
for(i=1;i<=n;i++)
{
indeg[i]=indegree(i);
if(indeg[i]==0)
... |
C | //
// main.c
// WEEK-2 homework
//
// Created by mac on 16/4/8.
// Copyright © 2016年 mac. All rights reserved.
//
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
//1. 实现交换两个变量的值--值传递
void valueSwap(int a, int b){
int tmp = a;
a = b;
b = tmp;
printf("a:%d b:%d\n",a,b)... |
C | //---------------------------------------------------
//ļΪRS485ͨŴ
//תоƬMAX485
//˿ڣUART3,TX--B10, RX--B11
// RE--C5, DE--C4
//עRE==0DE == 0ʱ,ݽ;
// RE==1DE == 1ʱ,ݷ
//ĿԲУREDEûӣ
//---------------------------------------------------
#include "sys.h"
#include "rs485.h"
#include "delay.h"
#include "string.h"
//ʱʱ
vol... |
C | /* Gets the neighbors in a cartesian communicator
* Orginally written by Mary Thomas
* - Updated Mar, 2015
* Link: https://edoras.sdsu.edu/~mthomas/sp17.605/lectures/MPI-Cart-Comms-and-Topos.pdf
* Modifications to fix bugs, include an async send and receive and to revise print output
*/
/* For question 2, parts a b an... |
C | #include <stdio.h>
#include "2048.h"
int tilt_line_left(int length,int *line)
{
// make sure vector length is sensible
if (length<1||length>255) return -1;
// slide tiles to the left
// combine tiles as required
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
main ()
{
int a,b,c;
printf("masukan bil. 1 :"); scanf("%d",&a);
printf("masukan bil. 2 :"); scanf("%d",&b);
printf("masukan bil. 3 :"); scanf("%d",&c);
if ((a==b) || (a==c))
{
printf("ADA");
}
else if ((b==a) || (b==c))
... |
C | // es1-16.c from K&R
// Leonardo Silvagni 2018
// Goal: Revise the program of thelongest input line
#include <stdio.h>
int usr_getline(char line[],int maxline);
void copy(char to[], char from[]);
const int MAXLINE = 1000;
int main(){
int len,max=0;
char line[MAXLINE],longest[MAXLINE];
while((len = usr_getline(line... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
#define BUFSIZE 1024
char buf[BUFSIZE] = "Hello World!";
/* Main program:
* * - Process arguments.
* * - Open socket and establish connection to server.
* * - Read text line by... |
C | //
// Created by ligand on 2019-04-12.
//
/**
* 使用动态链接来替代 标准c库 中的 malloc 和 free
*/
#ifdef RUNTIME
#define _GUN_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
static int malloc_size = 0;
void *malloc(size_t size)
{
void *(*mallocp)(size_t size);
char *error;
mallocp = dlsym(RTLD_NEXT, "mal... |
C | /*
* 嵥߳
*
* н̬߳(t1t2)
* ȼ߳t1
* ȼ߳t2һʱ̺ѵȼ̡߳
*/
#include <rtthread.h>
#include "tc_comm.h"
/* ָ߳̿ƿָ */
static rt_thread_t tid1 = RT_NULL;
static rt_thread_t tid2 = RT_NULL;
/* ߳1 */
static void thread1_entry(void* parameter)
{
/* ȼ߳1ʼ */
rt_kprintf("thread1 startup%d\n");
/* */
rt_kprintf("suspend thread self\n");
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strtok.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "cardset.h"
#include "cards.h"
#include "board.h"
void setup() {
time_t t;
// Intializes random number generator
srand((unsigned) time(&t));
struct CardSet deck;
startDeck(&deck);
struct Board board;
initializepiles(&board);
printCardSet(&de... |
C | /* ecc-pattern.c: generate ECC test patterns */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "types.h"
#include "ecc/ecc.h"
uint8_t block[4096];
uint8_t ecc_value[64];
int block_size;
int ecc_size;
int main(int argc, const char* argv[])
{
FILE* fp;
int i;
int i... |
C | //*************************************************************
//*
//* Copyright (c) 2016 : wang liang
//* License : Distributed under the GNU General Public License
//* created on : 4/07/2016, by wang liang (wliked@outlook.com)
//*
//*************************************************************
//swap value of two ... |
C | /*
** EPITECH PROJECT, 2019
** PSU_42sh_2018
** File description:
** unsetenv.c manage the function unsetenv
*/
#include <stddef.h>
#include "my.h"
#include "env.h"
char **remove_line(char **envp, int arg)
{
int j = 0;
int i = 0;
for (; envp[i] != NULL; i++) {
if (j == arg)
j++;
... |
C | #ifndef MD5A_H_SENTRY
#define MD5A_H_SENTRY
/*
* MD5.h
*
*/
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct __MD5_hash_value
{
unsigned char v [16];
} MD5_hash_value;
void HashBuffer_MD5 (const unsigned char *string, unsigned len, MD5_hash_value *hash);
/* UINT4 defines a fo... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<arpa/inet.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<netdb.h>
#include<netinet/in.h>
#include<unistd.h>
#include<ctype.h>
struct packet
{
char desti_ip[100];
char source_ip[100];
char source_mac[100];
char data[17];
};
int i... |
C | #include <linux/limits.h>
#include "LineParser.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include <signal.h>
#define TERMINATED -1
#define RUNNING 1
#define SUSPENDED 0
//declares
typedef struct process process;
void execute(cmdLine *pCmdLine);
void addP... |
C | #include "libFireBird.h"
bool HDD_Write(void *data, dword length, TYPE_File *f)
{
TRACEENTER();
static byte block[512];
static byte *b = block;
bool success = TRUE;
dword blen;
// flush buffer
if(length == 0)
{
if(b > block)
... |
C | #include<stdio.h>
#include<stdlib.h>
int c[10][10],n,vis[10];
void bfs(int src)
{
int i,j,f=0,r=0,q[10];
for(i=1;i<=n;i++)
vis[i]=0;
q[++r]=src;
++f;
while(f<=r)
{
i=q[f++];
for(j=1;j<=n;j++)
{
if(c[i][j]==1 && vis[j]==0)
{
q[++r]=j;
vis[j]=1;
}
}
}
}
void main()
{
int i,src,j;
... |
C | #include<stdio.h>
#include<stdlib.h>
typedef void (*funptr)(int);
funptr myfun(int x)
{
int p=x;
void fun(int y)
{
printf("old p:%d\n",p);
p=p+y;
printf("new p:%d\n",p);
printf("\n\n");
}
return fun;
}
int main(int argc, char const *argv[])
{
funptr myptr=myfu... |
C | #ifndef STACK_H_
# define STACK_H_
# include "list.h"
typedef struct stack
{
/* Properties */
struct list list;
/* Methods */
/* --- Modifiers --- */
void (*push)(struct stack *self, void *data);
void (*pop)(struct stack *self);
void (*clear)(struct stack *self);
/* --- Elem... |
C | #include<stdio.h>
#include<conio.h>
void tellsav(void);
void tellcur(void);
void layout(int x1,int y1,int x2,int y2,int ccb,int cct);
void main()
{
char options[10][40]={
"SAVINGS ACCOUNT",
"CURRENT ACCOUNT",
" ",
" ",
" "
};
int key=0,y=7,opt=0;
... |
C | #include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "ZCurveLUT.h"
#include "../../constants.h"
ZCurveLUT *generateZCurveLUT(int size)
{
ZCurveLUT *result = (ZCurveLUT *)malloc(sizeof(ZCurveLUT));
result->data = (BLOCK_TYPE **)malloc(NO_DIM * sizeof(BLOCK_TYPE *));
double ... |
C | /*
** orient.c: Code to convert a from/at/up cmaera model to the orientation
** model used by VRML.
** Copyright (C) 1995 Stephen Chenney (schenney@cs.berkeley.edu)
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public Licens... |
C | typedef struct Parser {
String fullpath;
Tokenizer tokenizer;
Token curr_token;
Token prev_token;
// >= 0: In Expression
// < 0: In Control Clause
// NOTE(bill): Used to prevent type literals in control clauses
isize expr_level;
bool allow_type;
} Parser;
typedef enum ParserError {
ParserError_None,
Par... |
C | #include<stdio.h>
int main(){
int a;
char b;
float c;
double d;
a = 2;
b = 'B';
c = 0.25;
d = 0.1543245679;
printf(" %d \n %c \n %.2f \n %.10f",a,b,c,d);
return 0;
}
/*
Saída:
2
B
0.25
0.1543245679
*/
|
C | #include <stdio.h>
int main()
{
char line[12] = {"hexadecimal"};
printf("%10s %15s %15.5s %.5s\n", line, line, line, line);
return 0;
}
|
C | /*
** EPITECH PROJECT, 2019
** list_utils2
** File description:
** Linked list functions
*/
#include "lib.h"
dlist_t *new_list(void)
{
return (NULL);
}
bool is_empty_list(dlist_t *li)
{
if (li == NULL)
return true;
return false;
}
dlist_node_t *search_list_op(dlist_t *li, int to_find)
{
if (... |
C | #include "stdio.h"
main()
{
float precoFab, pctLucroDist, pctImpostos, vlLucroDist, vlImpostos, vlFinal;
printf("Digite o preco de fabrica: ");
scanf("%f", &precoFab);
printf("Digite a porcentagem do distribuidor: ");
scanf("%f", &pctLucroDist);
printf("Digite a porcentagem dos impos... |
C | /*
* This is not a unit test. :)
* It's just a little 'sandbox'
* for playing around with code.
* It's easier to use GDB with than
* criterion.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <plugins.h>
int main() {
char *table_stack = \
"# Here is a table\n\n"
"| Name... |
C | #include<stdio.h>
//This is an implementation of linear convolution.
int main(){
int lx,lh,i,k;
printf("Enter length of x[n]");
scanf("%d",&lx);
printf("Enter length of h[n]");
scanf("%d",&lh);
int x[lx],h[lh],y[lx+lh-1];
printf("Enter elements for x[n]");
for(i=0;i<lx;i++)
{
... |
C | #ifndef _MATRIX_H
#define _MATRIX_H
#include "Vector.h"
// 3x3 matrix for 3d transforms and translations
// Arranged in column-major order as follows:
// _ _
// | 0 4 8 12 |
// Mat4.entry = | 1 5 9 13 |
// | 2 6 10 14 |
// | 3 7 11 15 |
// ... |
C | /*
* sequenceAlignment.c
*
* Here is the main program.
*
* Russ Brown
*/
/* @(#)sequenceAlignment.c 1.56 10/01/27 */
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <time.h>
#include "sequenceAlignment.h"
int main(int argc, char **argv) {
int myTaskID, ierr;
int randomSeed, scale, ma... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parser.c :+: :+: :+: ... |
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 | //Write a program to reverse a array.
#include<stdio.h>
void main()
{
int n,i,b;
printf("How many elements you want in array\n");
scanf("%d",&n);
int a[n];
printf("Enter array elements\n");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n/2;i++)
{
b=a[i];
a[i]=a[n-1-i];
a[n-1-i]=b;
}
p... |
C | #include "internal.h"
MIXED_EXPORT void mixed_free_segment_sequence(struct mixed_segment_sequence *mixer){
if(mixer->segments)
free(mixer->segments);
mixer->segments = 0;
}
MIXED_EXPORT int mixed_segment_sequence_add(struct mixed_segment *segment, struct mixed_segment_sequence *mixer){
mixed_err(MIXED_NO_ER... |
C | #include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<string.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<netdb.h> // defines hostent structure
int main(int argc,char *argv[]){
int sockfd,newsockfd,portno,n;
struct sockaddr_in serv_addr,cli_addr;
... |
C |
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include<fcntl.h>
#include <sys/stat.h>
#include <signal.h>
#define REPL_HISTORY_LIMIT 100
#define REPL_INPUT_LIMIT 100
#define REPL_MAX_TOKENS 15
#define REPL_ASYNC "&"
#define REPL_INPUT "... |
C | #include "generate_programme.h"
int sequence_accumulator[MAX_n];
int sequence_is_valid = false;
time_t starting_time = 0;
boolean first_time_through_recursion = true;
static mpz_t good_sequences; // Using the GNU multiple precision library.
static mpz_t predicted_number_of_candidate_sequences;
static mpz_t predicted_... |
C | #include<stdio.h>
int npair(int a, int n)
{
int first_iteration;
int dx;
int n;
int s;
int r;
for (dx = 1; (dx * 10) <= a; dx *= 10)
;
if (!((n >= dx) && ((dx * 10) > n)))
return 0;
r = 0;
for (n = a; n <= n; n++)
{
for (s = (n / 10) + ((n % 10) * dx); s != n; s = (s / 10) + ((s % 10) ... |
C |
#include "main.h"
int main( int argc, char *argv[ ] )
{
unsigned int frameLimit = SDL_GetTicks() + 16;
int go = 1;
/* Initialisation de la SDL dans une fonction séparée (voir après) */
init("TALIS");
initializeCamera();
/* On initialise le sol */
... |
C | //Alex Fialon
//afialon1
#include "functions.h"
#include <stdio.h>
#include <string.h>
#include <assert.h>
int read_file(FILE *fp, char words[][MAX_WORD_SIZE + 1], int size) {
//Skip the line with the size
//Set words length to the size
//Go to every line in the file
for(int i = 0; i < size; i... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include "holberton.h"
#ifndef BUFF_SIZE
#define BUFF_SIZE 1024
#endif
/**
* main - check the code for Holberton School students.
* @argc: name of my file
* @argv: number of the letters that i used
* Return: Always 0.
*/
int main(int argc,... |
C | #include <stdio.h>
#include <math.h>
int main(){
double A,B,C,delta;
scanf("%lf %lf %lf",&A,&B,&C);
delta = pow(B,2) -4*A*C;
if(delta<0 || A==0){
printf("Impossivel calcular\n");
}else{
double R1 = (-B +sqrt(delta))/(2*A);
double R2 = (-B -sqrt(delta))/(2*A);
printf("R1 = %.5lf\nR2 = %.5lf\n",R1,R2);
}... |
C | #include <stdio.h>
#include <math.h>
// v.14
float z1(a){
return ( (cos(a)+sin(a)) / (cos(a)-sin(a)) );
}
float z2(a){
return ( sin(2*a)/cos(2*a) + 1/cos(2*a) );
}
int main(){
float a;
scanf("%f", &a);
printf("%f\n%f\n", z1(a), z2(a));
}
|
C | /**
* @author: luyuhuang
* @brief:
*/
#ifndef _REACTER_EVENT_H_
#define _REACTER_EVENT_H_
#include <sys/types.h>
#include <sys/socket.h>
#include <stdint.h>
#include <stdbool.h>
#include <sys/time.h>
#include "basic.h"
typedef struct reactor_manager *reactor_t;
struct rfile {
int fd;
};
struct rtimer {
... |
C | #include<stdio.h>
#include<netinet/in.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<string.h>
#include<stdlib.h>
#include<netdb.h>
#include<unistd.h>
#include<signal.h>
#include<time.h>
int main(int argc, char *argv[])
{
struct sockaddr_in clientaddress;//address
pid_t pid;
int clientfd,s... |
C | #include"head.h"
int Socket(int domain,int type,int protocol)
{
int fd=socket(domain,type,protocol);
if(fd<=0)
{
perror("use socket");
exit(-1);
}
return fd;
}
int Bind(int sockfd,const struct sockaddr* addr,socklen_t addrlen)
{
int bd=bind(sockfd,addr,addrlen);
if(bd<0)
{
... |
C | /**************************************
* Program : htab_remove.c
* Author : Adrián Tomašov, FIT VUT
* Login : xtomas32
* Skupina : 1BIB(2015/2016)
* Created : 07.04.2016
* Compiled: gcc 4.8.4
* Project : ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
int main () {
int n_alunni ;
float R ;
printf ("Inserisci R: ") ;
scanf ("%f", &R) ;
printf ("Inserisci il numero di alunni: ") ;
scanf ("%d", &n_alunni) ;
int g = 1 ;
float v [n_alunni] ;
... |
C | //________________ memory access functions ____________________
#define MEMORY_SIZE 67108864
#define MEMORY_LIMIT 67108863
void store_memory(unsigned int addr,unsigned int data,unsigned char *MEMORY){
unsigned char data_bytes[4];
if (addr>MEMORY_LIMIT){
printf("ADDRESS OVERFLOW: %u\n",addr);
}
data_bytes[3] = (u... |
C | #include<stdio.h>
int main()
{
int a,b,t;
scanf("%d %d",&a,&b);
while(b!=0)
{
t = a%b;
a = b;
b = t;
}
printf("最大公约数是:%d\n",a);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
int main(int argc, char **argv){
if(argc<2){
printf("%s Indique un <puerto>\n",argv[0]);
return 1;
}
//Variables para obtener los id's del... |
C | #include "kernel.h"
#include "keyboard.h"
#include "utils.h"
#include "types.h"
#include "box.h"
#include "tic_tac_toe.h"
#define PLAYER_1 1
#define PLAYER_2 2
uint8 grid[3][3];
uint8 row = 0, col = 0;
uint8 turn = PLAYER_1;
uint16 player_1_moves = 0;
uint16 player_2_moves = 0;
uint16 grid_inner_box_x = 30;
uint16 ... |
C | #include "database.h"
//Creates a database named "dbname", hosted by "dbhost"
void database_creation(char * dbhost, char * dbname) {
printf("Creation of database %s, hosted by %s\n", dbname, dbhost);
//Query string creation
size_t dim = 32 + strlen(dbname);
char * query = malloc(dim);
if (query =... |
C | /**
* @file queue.c
* @brief Implementazione di queue.h
*
* Si dichiara che il contenuto di questo file è in ogni sua parte
* opera originale dell'autore.
*
* @author Lorenzo Beretta, 536242, loribere@gmail.com
*/
#include "queue.h"
// Funzioni esterne (documentate in "queue.h")
queue_t create_queue(int s) {... |
C | #include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "ctype.h"
/*
Fazer um programa que:
(a) leia uma frase de 80 caracteres, incluindo brancos,
(b) conte e imprima quantos brancos existem na frase,
(c) conte e imprima quantas vezes a letra ‘a’ aparece,
(d) substitua as vogais pelo caracter ‘X’.
*/
i... |
C | /*
LodePNG Examples
Copyright (c) 2005-2012 Lode Vandevenne
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including co... |
C | #include "lists.h"
#include <stdlib.h>
/**
* free_listint - This function frees a listint_t list
* @head: The listint_t list to free
*/
void free_listint(listint_t *head)
{
/* create temporary pointer to safely free list */
listint_t *tmp;
while (head != NULL)
{
/* assign head node to tmp node */
tmp = he... |
C | #include "../include/task.h"
#include "../include/myPrintk.h"
void schedule(void);
void destroyTsk(int takIndex);
/**
* 内部接口参考
*/
typedef struct rdyQueueFCFS
{
myTCB* head;
myTCB* tail;
myTCB* idleTsk;
} rdyQueueFCFS;
rdyQueueFCFS rqFCFS;
void rqFCFSInit(myTCB* idleTsk)
{
rqFCFS.head = (myTCB*)0;
rqFCFS.tail... |
C | #include <time.h>
#include "entrega.h"
u32 Greedy(Grafo G)
{
if(G == NULL)
return UINTMAX;
u32 i, j, totalColores;
totalColores = 1;
u32 *colores = calloc(NumeroDeVertices(G), sizeof(u32));
//Seteo todos los colores previos
for(i = 0; i < NumeroDeVertices(G); i++)
FijarColor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.